Categories | Question details Back To List | ||
Sort by SlectBox Associated string value ? Hello, I was wondering if there was a way to sort a selectbox column, not by the value of the select box, but by the content of the selectbox in the dhtmlXGrid ? In our case we have an Number associated to a String value loaded via a dataprocessor. Currently the sorting is done with the Numbe and not the String Value. So I looked at the custom sorting routines but same problem I can only acces the Number and not the String Associated. Any insight woud be deeply Apreciated. Nicolas Darques R&D VFX Eclair PARIS Answer posted by Stanislav on Nov 20, 2007 05:35 By default all columns sorted by value, but workaround for select boxes is possible. You can use custom sorting in next way mygrid2.setColSorting("str,str,str,str,str,custom_1,str,str"); function custom_1(a,b,ord,a_id,b_id){ a=mygrid2.cells(a_id,5).getText(); b=mygrid2.cells(b_id,5).getText(); return ord=="asc"?(a>b?1:-1):(a>b?-1:1); } here 5 - index of column with selectboxes if necessary - please contact us directly at support@dhtmlx.com - I will send you ready sample |