Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Hariharan on Feb 18, 2008 03:34
open dhtmlx forum
Custom Sort

Hi,

I need to add a custom sort. I'm loading my table through dhtmlXGridFromTable. Could you show some examples how to do that.

Thanks,
Hariharan.
Answer posted by Support on Feb 18, 2008 08:57
You can define custom sorting function directly in your HTML structure

<script>
    function my_custom(a,b,ord){
       if (ord=="asc")
          return a>b?1:-1;
    else
        return a<b?1:-1;
    }
</script>

    <table class="dhtmlxGrid" ...
       <tr>                                                   //<< first row define columns structure
          <td sort="my_custom">...               //<< sort attribute allow define sorting function