Column Sorting

Maybe I missing something, but I do not see how you set your grid to sort on a particular column in either ascending or descending mode when the grid first loads?

Frank L
February 18,
obj.sort(index) should do that. I will add the second argument to specify the direction.
Alex (ActiveWidgets)
February 18,
Your referring to the argument "index" as one of the columns such as "3"?



Frank L
February 19,
obj.sort(3, "descending");

just added to 0.2.7

Alex (ActiveWidgets)
February 19,
I am reading a CSV file and when I place the following code before the write object such as:

obj.sort(0, "descending"); // sort on first column


I get ONLY (1) row of data even though I have over 30 rows! If I remove the obj.sort than all rows appear.

I have installed your latest 0.2.7

Any ideas?
Frank L
February 19,
Sorry, I still need to do a proper fix. Unfortunately I don't see any simple workaroud. Here is a very bad solution:

(insert sorting into table.response(data))

var defaultResponse = table.response;
table.response = function(data){
defaultResponse.call(this, data);

This will refresh grid twice.
Alex (ActiveWidgets)
February 19,
The solution you provided does the job just fine and solves the problem if you are loading data into the GRID from a CSV file! Time permitting, I am sure that this would be a nice feature to add to the base.
Frank L
February 20,
While it may not always be possible to control your source of data, but might I suggest that you initially create your CSV file in the desired sort order.

My company considers it bad programming practice to overtask a client-side element with something which could have first been done on the server.

Likewise, we don't send data back to the server without first doing as much client-side validation as possible.

And, yes, I am the President of my company, so that is how I develop my WBA's (Web Based Applications) :-)
October 12,

This topic is archived.

See also:

Back to support forum