Categories | Question details Back To List | ||
Sorting Combo Based Excells Hi, I would like to be able to sort a column of combo excells by the text displayed rather than the value of the selected item. For example we have a combo populated with a list of employees, the value corresponds to their id in a database and is fairly meaningless in the grid. The grid will sort the following list as "Ben, Andy, Chris" based on value rather than "Andy,Ben,Chris" by their name. Would it be possible to have a special combo sort mode or to write a custom sort function to handle this, I looked at the custom sort code but it seems it is only passed the value and doesn't have access to the names. <option value="3">Chris</option> <option value="1">Ben</option> <option value="2">Andy</option> Thanks, Darren. Answer posted on May 31, 2007 14:22 Basically there are two ways to achieve such functionality a) Using custom sort functions, in case of plain grid it provide 5 parameters valueA valueB order ID of row A* ID or row B* * - those parameters may be changed in next version of grid. Something similar to next will work as required grid.setCustomSorting(function(a,b,c,d,e){ return (grid.cells(d,3).getText()>grid.cells(e,3).getText())?1:-1; },3); b) You can made small custom modification in js code of grid, in dhtmlxGrid.js next line can be located if (atype=="link") amet="getContent"; just add next to it if (atype=="co") amet="getText"; this will force usage of combo labels instead of values. Answer posted by Nadine (Support) on Dec 04, 2014 10:19 I hope this information will be enough for you. But you also can have a look at dhtml filters and upload file ajax. |