Categories | Question details Back To List | ||
Sorting columns in the DHTML Grid Hi, Could you please let me know, how to sort dates in a column in descending order(recent date firt) by default. i.e. the grid needs to sorted based on the date and the date should be sorted in descending order by default. Thanks in advance for you help. Answer posted by dhxSupport on Mar 17, 2009 04:17 1. Necessary columns should have "calendar", "dhxCalendar" or "dhxCalendarA" type 2. Set "date" sorting type with method mygrid.setColSorting("str,date,date"); 3. After grid was loaded call sortRows method mygrid.loadXML("grid_dates.xml",function(){ sortRows(col, type, order): col - index of column, by which grid need to be sorted type - sorting type (str,int,date), optional, by default sorting type taken from column setting order - sorting order (asc,des), optional, by default sorting order based on previous sorting operation Also if you want to show sorting image add setSortImgState method after calling sortRows. setSortImgState(state, ind, order, row): state - true/false - show/hide image, ind - index of field, order - asc/desc - type of image, row - one based index of header row ( used in multirow headers, top row by default ) |