Custom sorting in Dataview

Please can you tell me in Custom sorting with Data view what are the 2 objects that are passed to the function? How can I tell the system which item/items should be passed? Do you have a sample that I can look at?

Thanks
Purvez

here is the documention:
docs.dhtmlx.com/doku.php?id=dhtm … ew:sorting

Two parameters of the custom sorting function are two data objects from dataview. They are passed automatically as sorting function is called for each data object.
All you need is to define the sorting rule (return part).

Thanks for your reply Alexandra. If I want to sort by 2 different properties depending on some choice that the user makes then can I create 2 view.sort(function(x,y){ } functions? Please can you confirm that I can do that.

Thanks

Actually you can use a single method
You can place any count of comparation in it, just return 1 or -1 to decide which object must be above the other one.

view.sort(function(objA, objB){ if (objA.some_value == objB.some_value){ //id object equal by first parameter return objA.other_value > objB.other_value?1:-1; //sort them by second one } return objA.some_value > objB.some_value?1:-1; },"asc");

Thanks for that Stanislav. I actually wanted to sort by say either category or price depending on user choice, but what you are suggesting allows me to do price within category which is even better.