Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Keith Hooker on Oct 23, 2008 06:31
open dhtmlx forum
Custom Sorting not working?

Hi all,
We are evaluating dhtmlxGrid for purchase and I can't get custom sorting to work at all. Is that disabled in the free version?

Thanks, Keith


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <title>Untitled</title>
    
    <link rel="STYLESHEET" type="text/css" href="../codebase/dhtmlxgrid.css">
    <script src="../codebase/dhtmlxcommon.js"> </script>
    <script src="../codebase/dhtmlxgrid.js"> </script>
    <script src="../codebase/dhtmlxgridcell.js"> </script>
    <script>
    
        function str_custom(a,b,order)
        {
         if (order=="asc")
         return (a.toLoweCase()>b.toLoweCase()?1:-1);
         else
          return (a.toLoweCase()<b.toLoweCase()?-1:1);
        }

        
        function sort_custom(a,b,order)
        {
     var n=a.length;
     var m=b.length;
         if(order=="asc")
          return n>m?1:-1;
         else
          return n<m?1:-1;
     }
    
        var mygrid;
        function doInitGrid()
        {
         mygrid = new dhtmlXGridObject('mygrid_container');
         mygrid.setImagePath("../codebase/imgs/");
         mygrid.setHeader("Model,Qty,Price");
         mygrid.setInitWidths("250,150,150");
         mygrid.setColAlign("left,left,right");

         mygrid.setColSorting("str,str_custom,int");

         mygrid.setColTypes("ed,ed,price");
         mygrid.setSkin("light");
         mygrid.init();

            myrow = new Array("My Fifth Cell","Jimmy","45,000");
            
            mygrid.addRow(1001,    "My first cell,keith,10010");
            mygrid.addRow(1002,    "My second cell,leslie,20010");
            mygrid.addRow(1003,    "My third cell,bailey,30010");
            mygrid.addRow(1004,    "My fourth cell,keegan,40010");    
            mygrid.addRow(1004,    myrow);            
        }
    
    
    </script>
</head>

<body onload="doInitGrid();">

<div id="mygrid_container" style="width:600px;height:350px;"></div>

</body>
</html>
Answer posted by Support on Oct 23, 2008 07:15
Custom version doesn't supported in standard edition of grid, only in pro.