<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
	<title>jQuery Grid Plugin - jqGrid - Topic: Integration with Taffy DB for multisort and dataset management</title>
	<link>http://www.trirand.com/blog/?page_id=393/feature-request/integration-with-taffy-db-for-multisort-and-dataset-management</link>
	<description><![CDATA[Grid plugin]]></description>
	<generator>Simple:Press Version 5.7.5.3</generator>
	<atom:link href="http://www.trirand.com/blog/?page_id=393/feature-request/integration-with-taffy-db-for-multisort-and-dataset-management/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>matt.pardee on Integration with Taffy DB for multisort and dataset management</title>
        	<link>http://www.trirand.com/blog/?page_id=393/feature-request/integration-with-taffy-db-for-multisort-and-dataset-management#p20663</link>
        	<category>Feature Request</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/feature-request/integration-with-taffy-db-for-multisort-and-dataset-management#p20663</guid>
        	        	<description><![CDATA[<p><!-- p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Tahoma} p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Tahoma; min-height: 17.0px} p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; line-height: 15.0px; font: 12.0px Courier; color: #232323} p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; line-height: 15.0px; font: 12.0px Courier; color: #232323; min-height: 14.0px} p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; line-height: 15.0px; font: 14.0px Tahoma; min-height: 17.0px} p.p6 {margin: 0.0px 0.0px 0.0px 0.0px; line-height: 15.0px; font: 14.0px Tahoma} span.Apple-tab-span {white-space:pre} --></p>
<p class="p1">Tony,</p>
<p class="p2">&#160;</p>
<p class="p1">I cannot express enough my gratitude for your dedication to such a solid grid utility with its extensive set of features. As far as I&#39;m concerned, jqGrid is unmatched in its ruggedness and sophistication. Thank you for your hard work!</p>
<p class="p2">&#160;</p>
<p class="p1">Like others on this forum, I was looking for a grid utility that could perform multi-sort operations on its data. As jqGrid doesn&#39;t have this feature yet, I want to request in earnest that Taffy DB is considered for such a feature, as I will outline the reasons for below. If you haven&#39;t heard of Taffy DB, it&#39;s a JavaScript-based database container that performs all of its operations within the client&#39;s browser. It&#39;s lightweight, fast, and capable as a CRUD interface. Website: <a href="http://taffydb.com" rel="nofollow" target="_blank">http://taffydb.com</a></p>
<p class="p2">&#160;</p>
<p class="p1">The primary inspiration for this feature request is Taffy DB&#39;s ability to run multisort operations on the dataset. From there, it&#39;s easy to retrieve the number of rows you want. For example, let&#39;s say you have this dataset:</p>
<p class="p2">&#160;</p>
<p class="p3">var mydata = [</p>
<p class="p3">{id:"1",invdate:"2010-05-24",name:"test",note:"note",tax:"10.00",total:"2111.00"} ,</p>
<p class="p3">{id:"2",invdate:"2010-05-25",name:"test2",note:"note2",tax:"20.00",total:"320.00"},</p>
<p class="p3">{id:"3",invdate:"2007-09-01",name:"test3",note:"note3",tax:"30.00",total:"430.00"}</p>
<p class="p3">];</p>
<p class="p4">&#160;</p>
<p class="p3">;to set up Taffy DB instance on this data:</p>
<p class="p4">&#160;</p>
<p class="p3">var taffy_data = new TAFFY(mydata);</p>
<p class="p4">&#160;</p>
<p class="p3">;and then to do multisort on the data, run the "orderBy" function:</p>
<p class="p4">&#160;</p>
<p class="p3">taffy_data.orderBy(</p>
<p class="p3">[</p>
<p class="p3">{ tax: "desc"},</p>
<p class="p3">{ id: "asc"},</p>
<p class="p3">{ name: "logical" }</p>
<p class="p3">]</p>
<p class="p3">);</p>
<p class="p4">&#160;</p>
<p class="p3">; (note "logical" here sorts "like a human would expect" -- from the Taffy DB docs), you can also use "logicaldesc"</p>
<p class="p4">&#160;</p>
<p class="p3">;To get the results, simply:</p>
<p class="p4">&#160;</p>
<p class="p3">taffy_data.get();</p>
<p class="p4">&#160;</p>
<p class="p3">;Or to get a subset of results, simply slice() (as the data is stored as an array)</p>
<p class="p4">&#160;</p>
<p class="p3">taffy_data.get().slice(0, 1);</p>
<p class="p5">&#160;</p>
<p class="p5">&#160;</p>
<p class="p6">As you can see, working with Taffy is incredibly easy. It appears to me that jqGrid already operates on its data as an array, so if the lack of multisort is because of a lack of code to perform the sorting, then perhaps the Taffy DB sorting code could be repurposed for this feature. It is my hope that you can run with Taffy&#39;s code and easily apply it to jqGrid&#39;s own codebase.</p>
<p class="p2">&#160;</p>
<p class="p1">Admittedly I have noticed an issue with Taffy DB&#39;s own sorting algorithm, which I have notified the developer about but haven&#39;t gotten a response. Take this dataset:</p>
<p class="p2">&#160;</p>
<p class="p3">var mydata2 = [</p>
<p class="p3">{id:"1",invade:"2010-05-24",name:"test2",note:"note",tax:"12.00",total:"2111.00"} ,</p>
<p class="p3">{id:"2",invade:"2010-05-25",name:"test2",note:"note2",tax:"12.00",total:"320.00"},</p>
<p class="p3">{id:"3",iinvade"2007-09-01",name:"test2",note:"note3",tax:"12.00",total:"430.00"}</p>
<p class="p3">];</p>
<p class="p4">&#160;</p>
<p class="p1">Note the same values for the "name" and "tax" columns. If an orderBy operation is performed on the "name" and "tax" columns *only*, the resultant dataset is inconsistent form one sort to another. For example:</p>
<p class="p2">&#160;</p>
<p class="p3">var taffy_bad_sort = new TAFFY(mydata2);</p>
<p class="p4">&#160;</p>
<p class="p3">taffy_bad_sort.orderBy(</p>
<p class="p3">[</p>
<p class="p3">{ name: "desc"},</p>
<p class="p3">{ tax: "asc"}</p>
<p class="p3">]</p>
<p class="p3">);</p>
<p class="p4">&#160;</p>
<p class="p3">taffy_bad_sort.get();</p>
<p class="p4">&#160;</p>
<p class="p3">;; The above get will print data in one way, however if we run the sort again:</p>
<p class="p4">&#160;</p>
<p class="p3">taffy_bad_sort.orderBy(</p>
<p class="p3">[</p>
<p class="p3">{ name: "desc"},</p>
<p class="p3">{ tax: "asc"}</p>
<p class="p3">]</p>
<p class="p3">);</p>
<p class="p4">&#160;</p>
<p class="p3">taffy_bad_sort.get();</p>
<p class="p4">&#160;</p>
<p class="p3">;; The resultant sort can (and does) produce a different result from the first sort.</p>
<p class="p4">&#160;</p>
<p class="p4">&#160;</p>
<p class="p1">I&#39;m not keen on sorting algorithms, however this seems to be a pretty naive mistake that could be easily alleviated, perhaps by keeping a copy of the original array and comparing the index values of the original row IDs with the new row IDs where column data is the same, and the sorting algorithm can decide which row goes first based on the original row order.</p>
<p class="p2">&#160;</p>
<p class="p1">In any event, I am adding my voice to the chorus of developers who look at jqGrid as their primary solution for grid-based data, but is missing this one feature that would otherwise make it the consummate solution. And please know that it isn&#39;t my intention to offend other posters here who are requesting other features, but from my perspective multi-row sorting is an absolutely essential feature.</p>
<p class="p2">&#160;</p>
<p class="p1">I would love to lend a hand to this feature, however I can&#39;t gauge how open this project is to outside contribution. Additionally I know it would take me a while to get informed on the code, but with a community of developers working on this feature, we could perhaps speed up the process. I see the source is available on Github. I need to get familiar with Github, but if I do, do you merge contributions from other developers?</p>
<p class="p2">&#160;</p>
<p class="p1">Thank you again for your hard work, your dedication, and for respectfully fielding requests from outsiders like me who benefit from this great utility.</p>
<p class="p2">&#160;</p>
<p class="p1">Best Regards,</p>
<p class="p2">&#160;</p>
<p class="p1">Matt</p>
]]></description>
        	        	<pubDate>Thu, 04 Nov 2010 11:40:04 +0200</pubDate>
        </item>
</channel>
</rss>