Categories | Question details Back To List | ||
Can't get custom sorting to work Hi, I can't get the custom sorting to work. It's probably quite simple, but I can't find it. Here's the code for the header in the XML: <?xml version='1.0'?> <rows> <head> <column type="coro" width="50" sort="custom_1">Klant <option value="6">AGM</option> <option value="3">CBH</option> <option value="2">CGP</option> <option value="1">CIT</option> <option value="11">COM</option> <option value="8">EMX</option> <option value="10">HAC</option> <option value="5">KOE</option> <option value="9">MOE</option> <option value="7">VGO</option> </column> [snip]more header[/snip] </head> [snip]data[/snip] </rows> And here's the JS init-part: mygrid= new dhtmlXGridObject('container_overzicht'); mygrid.selMultiRows = true; mygrid.setImagePath("dhtmlx/dhtmlxGrid/imgs/"); mygrid.attachEvent("onBeforeSorting",function(cInd,type,direction){ alert('Kolom: '+cInd+', type: '+type+', dir: '+direction); }); mygrid.enableDragAndDrop(false); mygrid.init(); mygrid.setSkin("dhx_black"); mygrid.loadXML("ajax/taken/gettaken.php"+params); mygrid.attachEvent("onEditCell", DoOnEditCell); And the function custom_1 (meant to be sorting the column): function custom_1(a,b,ord,a_id,b_id){ a=mygrid2.cells(a_id,0).getText(); b=mygrid2.cells(b_id,0).getText(); return ord=="asc"?(a>b?1:-1):(a>b?-1:1); } The event OnBeforeSorting I added only for debugging purposes. What struck me as odd was that the alert says that the column <strong>type<strong> is custum_1... A clue? Meanwhile, sorting works for all the other columns, but not the first one. Help would be appreciated. Answer posted by dhxSupport on Dec 30, 2009 02:56 >>The event OnBeforeSorting I added only for debugging purposes. What struck me as odd was that the alert says that the column <strong>type<strong> is custum_1... A clue? "type" argument contain type of the sorting - str, int, date,na or name of the custom sorting function. >>Meanwhile, sorting works for all the other columns, but not the first on "onBeforeSorting" event is blockable (if custom code, attached to event, returns value different from true - sorting operation will be blocked). Answer posted by Ooypunk on Dec 30, 2009 03:59 As you can see, the onBeforeSorting returns true always. But, to be sure, I removed that part, as it wasn't necessary. But it changes nothing, sorting still doesn't work. Is there something else I should check? Do you need more information? Answer posted by Alex (support) on Jan 12, 2010 08:25 Hello sorry for delay. Custom sorting functionality works only in PRO edition. If the issue occurs with PRO edition, please provide the sample to support@dhtmlx.com to recreate it |