Daryl
May 3, 2014, 12:04am
#1
Hi Folks,
We are using the Pro version of dhtmlx and trying to use a custom time sort function, but the function never gets called. Here is the code:
[code]var sortByTime = function(a, b, order) {
var sorted = null;
a = a.split(":");
b = b.split(":");
if ( a[0] == b[0] ) {
sorted = (a[1] > b[1] ? 1 : -1) * (order == "asc" ? 1 : -1);
}
else {
sorted = (a[0] > b[0] ? 1: -1) * (order == "asc" ? 1 : -1);
}
return sorted;
};
jobs_grid.setColSorting(“int,date,sortByTime,str,str,str,str,str,str,str,str,str,str”);
jobs_grid.setCustomSorting(sortByTime, 2);[/code]
Any help in trying to figure this out would be much appreciated.
Thanks,
Daryl
Unfortunately the issue cannot be reproduced locally.
The function calls well for us.
Please, make sure that you are using js files from the PRO version of dhtmlxgrid.
I am facing exact same issue in pro version. My function is never getting called.
[code]function cust_sort(a,b,order,aid,bid){
var is_a = mygrid.cells(aid,15).isChecked() || mygrid.cells(aid,13).isChecked() || mygrid.cells(aid,14).isChecked();
var is_b = mygrid.cells(bid,
15).isChecked() || mygrid.cells(bid,13).isChecked() || mygrid.cells(bid,14).isChecked();
if(is_a && !is_b )
return -1;
if(!is_a && is_b )
return 1;
if(a==b){
// 5 is the index of the Address Line 1 column.
var a2=mygrid.cells(aid,6).getValue();
var b2=mygrid.cells(bid,6).getValue();
if(order=="asc")
return (a2.toLowerCase() > b2.toLowerCase()?1:-1);
else
return (a2.toLowerCase() < b2.toLowerCase()?1:-1);
}
if(order=="asc")
return (a.toLowerCase() > b.toLowerCase()?1:-1);
else
return (a.toLowerCase() < b.toLowerCase()?1:-1);
}[/code]
mygrid.setCustomSorting(cust_sort,6);
Unfortunately the problem cannot be reconstructed locally.
Please, refer to the following snippet:
snippet.dhtmlx.com/8c1a058df