Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by ez on Jun 10, 2009 02:54
open dhtmlx forum
How to check column sorting type?

Something like:

grid.getColSorting(0) = "int" or "str"
Answer posted by dhxSupport on Jun 10, 2009 03:35
To know type of sorting you can use events:
"onBeforeSorting" - occurs before starting data sorting.  onBeforeSorting event passes the following parameters: 
- column index
- sorting type (“str”,”int”,”date”)
- direction of sorting (“asc”,”des”)

"onAfterSorting" - occurs exactly after sorting took place in the grid. Parameters: 
- column index
- sorting type (“str”,”int”,”date”)
- direction of sorting (“asc”,”des”)
 grid.attachEvent("onAfterSorting", function(index,type,direction){
  //any custom logic here
  });


Answer posted by ez on Jun 10, 2009 04:44
Yea, this will work, but I need to know sorting type in other places of code, even when there were no sorting event fired.
Answer posted by dhxSupport on Jun 10, 2009 04:57
You fild out that information using method 
mygrid.fldSort[INDEX] where INDEX - index of a column