Forum
11:40
04/11/2010
Tony,
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'm concerned, jqGrid is unmatched in its ruggedness and sophistication. Thank you for your hard work!
Like others on this forum, I was looking for a grid utility that could perform multi-sort operations on its data. As jqGrid doesn'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't heard of Taffy DB, it's a JavaScript-based database container that performs all of its operations within the client's browser. It's lightweight, fast, and capable as a CRUD interface. Website: http://taffydb.com
The primary inspiration for this feature request is Taffy DB's ability to run multisort operations on the dataset. From there, it's easy to retrieve the number of rows you want. For example, let's say you have this dataset:
var mydata = [
{id:"1",invdate:"2010-05-24",name:"test",note:"note",tax:"10.00",total:"2111.00"} ,
{id:"2",invdate:"2010-05-25",name:"test2",note:"note2",tax:"20.00",total:"320.00"},
{id:"3",invdate:"2007-09-01",name:"test3",note:"note3",tax:"30.00",total:"430.00"}
];
;to set up Taffy DB instance on this data:
var taffy_data = new TAFFY(mydata);
;and then to do multisort on the data, run the "orderBy" function:
taffy_data.orderBy(
[
{ tax: "desc"},
{ id: "asc"},
{ name: "logical" }
]
);
; (note "logical" here sorts "like a human would expect" -- from the Taffy DB docs), you can also use "logicaldesc"
;To get the results, simply:
taffy_data.get();
;Or to get a subset of results, simply slice() (as the data is stored as an array)
taffy_data.get().slice(0, 1);
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's code and easily apply it to jqGrid's own codebase.
Admittedly I have noticed an issue with Taffy DB's own sorting algorithm, which I have notified the developer about but haven't gotten a response. Take this dataset:
var mydata2 = [
{id:"1",invade:"2010-05-24",name:"test2",note:"note",tax:"12.00",total:"2111.00"} ,
{id:"2",invade:"2010-05-25",name:"test2",note:"note2",tax:"12.00",total:"320.00"},
{id:"3",iinvade"2007-09-01",name:"test2",note:"note3",tax:"12.00",total:"430.00"}
];
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:
var taffy_bad_sort = new TAFFY(mydata2);
taffy_bad_sort.orderBy(
[
{ name: "desc"},
{ tax: "asc"}
]
);
taffy_bad_sort.get();
;; The above get will print data in one way, however if we run the sort again:
taffy_bad_sort.orderBy(
[
{ name: "desc"},
{ tax: "asc"}
]
);
taffy_bad_sort.get();
;; The resultant sort can (and does) produce a different result from the first sort.
I'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.
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'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.
I would love to lend a hand to this feature, however I can'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?
Thank you again for your hard work, your dedication, and for respectfully fielding requests from outsiders like me who benefit from this great utility.
Best Regards,
Matt
Most Users Ever Online: 715
Currently Online:
99 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66