Groupby causing problem with int sorting

Hello Support,



I am using the following code for displaying cpu and memory stats in grid. Usually int column sorting works for me. But since I have used groupby - it’s not working. what needs to change? Please advise.



        mygrid = new dhtmlXGridObject(‘gridbox’);

        mygrid.setImagePath(“dhtmlxgrid/codebase/imgs/”);

        mygrid.selMultiRows = true;

        mygrid.setHeader(“TX,Type,Avail,%CPU,%Mem”);

        mygrid.setInitWidths(“50,50,50,50,55”);        

        mygrid.setColAlign(“center,center,center,left,left”);

        //mygrid.setColTypes(“ro,colorcells”);

        mygrid.setColTypes(“ro,ro,ro,ro,ro”);

        mygrid.setColSorting(“server,server,server,server,server”);

        mygrid.setColSorting(“str,str,int,int,int”);

        mygrid.enableRowsHover(true,‘grid_hover’);

        mygrid.setSkin(“light”);

        mygrid.init();

     mygrid.groupBy(1);    

     mygrid.setColumnHidden(1,true);

     mygrid.loadXML(“getinfo.asp”)




Sorting should works well with grouping functionality.


If grid sorted by column , by which grid grouped - order of groups changed



If grid sorted by any other columns - the order of groups not changed, but rows in groups sorted in necessary order


Thanks for the response.



Is it possible that the image that is included along with the number in the same cell is causing the problem? Is there any alternative method? - I need to show both the (green/red) gif and the numeric value.



Here is the snippet of asp code



if (rs(“per_cpuload”) >= 0) and (rs(“per_cpuload”) < 60) then
  Response.write("<![CDATA[   " & rs("per_cpuload") & "]]>")
elseif (rs(“per_cpuload”) >= 60) and (rs(“per_cpuload”) < 80) then
  Response.write("<![CDATA[   " & rs("per_cpuload") & "]]>")
else
  Response.write("<![CDATA[   " & rs("per_cpuload") & "]]>")
end if



Thanks very much!



skm


Hello,


Yes, the issue is caused by using images in the cell.


How does sorting work in grid ? - grid compares pairs of values that the getValue method returns.


getValue of ro excell (all columns in your grid have this type) returns the inner html of the cell - the image tag too.


There are the following methods. You can choose one of them:


1) dyn excell instead of ro - down up arrows will be shown automatically: dhtmlx.com/docs/products/dhtmlxG … extra.html


2) creating custom excell. Please, see teh article in the package dhtmlxGrid/doc/articles/Custom_excell_creation.html


3) setting custom sorting function: dhtmlxGrid/doc/articles/Sorting_in_grid.html

Thanks for the quick reply.