Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by andreea on Sep 30, 2008 02:41
open dhtmlx forum
sorting int data problem

this is the xml:
<?xml version='1.0' encoding='UTF-8'?>
<rows>
<row id='322'>
<cell >11</cell>
<cell >0</cell>
<cell >12</cell>
<cell style='background-color: #5ce5e3' >Dag</cell>
<cell >6</cell>
<cell >116</cell>
<cell >2</cell>
<cell style='background-color:red' >-2</cell>
<cell >13:31</cell>
</row>
<row id='322'>
<cell >11</cell>
<cell >0</cell>
<cell >12</cell>
<cell style='background-color: #e5d1ab' >Late shift</cell>
<cell >2</cell>
<cell >116</cell>
<cell >0</cell>
<cell style='background-color:red' >-2</cell>
<cell >15:15</cell>
</row>
<row id='322'>
<cell >11</cell>
<cell >0</cell>
<cell >12</cell>
<cell style='background-color: #c2b3e5' >Nacht shift</cell>
<cell >1</cell>
<cell >116</cell>
<cell >2</cell>
<cell >3</cell>
<cell >16:16</cell>
</row>
</rows>


and these are the configurations :
mygrid = new dhtmlXGridObject('gridbox');
mygrid.setImagePath("<?=BASEURL?>fw_headers/js/dhtmlx/dhtmlxgrid/codebase/imgs/");
mygrid.setHeader(" <?=LBL_ROUTENUMBER?>,<?=LBL_DIRECTION?>,<?=LBL_NUMBEROFSTOPS?>, <?=LBL_SHIFTNAME?>, <?=LBL_COUNTPERSONS?>,<?=LBL_OVERCAPACITY?>,<?=LBL_SUMCAPACITY?>,<?=LBL_OVERFLOW?>,<?=LBL_DURATION?>");
mygrid.setInitWidths("30,55,50,100,70,100,100,100,53");
mygrid.setColAlign("center,center,center,center,center,center,center,center,center");
mygrid.setColTypes("ro,ch,ro,ro,edn,ro,ro,ro,ro");
mygrid.setColSorting("int,int,int,int,int,int,int,int,int");
mygrid.enableMultiselect(true);
mygrid.enableAlterCss("even","uneven");
mygrid.enableAutoHeigth(true);
mygrid.init();
mygrid.setSkin("light");
mygrid.loadXML("<?php echo BASEURL; ?>/xml_grids/<?=$actFileName?>");
mygrid.setSizes();
mygrid.enableMultiselect(false);

I tried to order a column containing numbers and I can't.
I have checked their type and they are all strings (all the values, including numbers, all thought when I built the xml I used intval to convert them into int: fwrite($fp," <cell >".intval($bustrip['CountPersons'])."</cell>\n"); )
Answer posted by Support on Sep 30, 2008 07:41
XML, which you are using is incorrect, all rows have the same ID , but ID must be unique for each row.