Sorting javascript arrays
Bas Wenneker has a nice little article over at solutoire.com on sorting javascript arrays. The docs over at Mozilla on Array.sort demonstrate the same stuff, but Bas’s article is a quick read that’s worth it if you ever see yourself working with data this way.
objectArray.sort(callbackFunc);
/**
* After sorting the objectArray will be like this:
* [
* {firstname: 'Will', lastname: 'Brown', age: 28},
* {firstname: 'John', lastname: 'Doe', age: 25},
* {firstname: 'Marie', lastname: 'Doe', age: 28},
* {firstname: 'Sarah', lastname: 'Doe', age: 25},
* {firstname: 'James', lastname: 'White', age: 28},
* {firstname: 'George', lastname: 'Williams', age: 25}
* ]
*/

March 25th, 2008 at 11:54 pm
i m trying to solve client side sorting using asp.net+javascript+dyanamic data means database but still i have no solution about sorting…so plz give me any idea about client side sorting….
regards
Mayank