Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Scott on Nov 26, 2007 02:14
open dhtmlx forum
colType int and link not sorting

Hello,

I am evaluating your product and almost certainly about to buy but have a small problem. We have some dynamicallly created XML and this all works fine to create a grid. However the only sorting method that seems to be working is str -any other does not sort at all, the arrows in the header move but the rows do not sort.

Here is some code: This is part of building the string for the header depending on some preferences of the user.

if($strESN=="checked")        echo 'colHeaders=colHeaders+"ESN,"; colWidths=colWidths+"100,"; colAlign=colAlign+"center,"; colTypes=colTypes+"ro,"; colSort=colSort+"str,"; ';

This works fine but as the column contains numbers it is not sorting correctly. Changing the code to.

if($strESN=="checked")        echo 'colHeaders=colHeaders+"ESN,"; colWidths=colWidths+"100,"; colAlign=colAlign+"center,"; colTypes=colTypes+"ro,"; colSort=colSort+"int,"; ';

and the column stops sorting altogther. We have the same problem with a coloumn that has links in. It does not sort properly with str but changing it to link stops it working.

Have you any ideas?
Answer posted by Stanislav on Nov 26, 2007 03:53
Unfortunately problem can't be reconstructed with local samples.
The sorting works for int sorting type
    http://dhtmlx.com/docs/products/dhtmlxGrid/samples/rows_columns_manipulations/pro_sort_image.html?un=1196078428000
and for link excell as well
    http://dhtmlx.com/docs/products/dhtmlxGrid/samples/cell_types/link_grid.html?un=1196078486000

Please beware that for parsing values as ints parseFloat used, and if value of cells contains some values which can't be correctly converted to numbers with parseFloat - sorting will not work correctly.
Also please be sure that you colSort variable doesn't contain unnecessary whitespaces ( this must be a strict list, only sorting types and comma allowed )

The link excells sorted by text label ( not by URLs )

If problem still occurs for you - please provide any kind of sample where problem can be reconstructed.( you can send it directly to support@dhtmlx.com )