Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Raghu on Oct 31, 2008 09:08
open dhtmlx forum
Grid

Hi,
custom sorting for the integer links is not working, i mean its ordering sequence is not correct
this is the following code for the custom sort

function sort_custom(a,b,order){ //alert(mygrid.cells(id,0).getValue());   //the name of the function must be > than 5 chars
  a = a.replace(/\<a.*?\>/,"").replace("</a>","");
  b = b.replace(/\<a.*?\>/,"").replace("</a>","");
  return (parseInt(a)> parseInt(b)?1:-1)*(order=="asc"?1:-1)
       
}
Answer posted by Support on Oct 31, 2008 10:00
Please try to use
function sort_custom(a,b,order){ //alert(mygrid.cells(id,0).getValue()); //the name of the function must be > than 5 chars
  a = a.replace(/<[^>]*>/g,"");
  b = b.replace(/<[^>]*>/g,"");
  return (parseInt(a)> parseInt(b)?1:-1)*(order=="asc"?1:-1)   
}