Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by ihsany on Dec 26, 2008 10:08
open dhtmlx forum
grid duplicate rows on srnd mode

hi,

i m using dhtmlxgrid on srnd mode and loading data from server by xml. i m loading 12 rows firstly, but when i load 13. row
12. row loading again. but this issue is only for 12. row. when i load other rows, there is no problem..

firstly grid source is;

<?xml version="1.0" encoding="utf-8"?>
<rows total_count="13" pos="0">
<row id="13">
<cell name="Code" val="HAKUÖR00013">HAKUÖR00013</cell>
</row>
<row id="12">
<cell name="Code" val="HASUDN00012">HASUDN00012</cell>
</row>
<row id="11">
<cell name="Code" val="DCDSCDCC00011">DCDSCDCC00011</cell>
</row>
<row id="10">
<cell name="Code" val="HPLTL00010">HPLTL00010</cell>
</row>
<row id="9">
<cell name="Code" val="HRUKE00009">HRUKE00009</cell>
</row>
<row id="8">
<cell name="Code" val="HRUKE00008">HRUKE00008</cell>
</row>
<row id="7">
<cell name="Code" val="HPLEL00007">HPLEL00007</cell>
</row>
<row id="6">
<cell name="Code" val="HPLEL00006">HPLEL00006</cell>
</row>
<row id="5">
<cell name="Code" val="HSLSU00005">HSLSU00005</cell>
</row>
<row id="4">
<cell name="Code" val="HSLSU00004">HSLSU00004</cell>
</row>
<row id="3">
<cell name="Code" val="HORSU00003">HORSU00003</cell>
</row>
<row id="1">
<cell name="Code" val="HOREL00001">HOREL00001</cell>
</row>
</rows>

and when i scroll firstly xml like ;

<?xml version="1.0" encoding="utf-8"?>
<rows total_count="13" pos="12">
<row id="14">
<cell name="Code" val="HAKUÖR00014">HAKUÖR00014</cell>
</row>
<row id="13">
<cell name="Code" val="HAKUÖR00013">HAKUÖR00013</cell>
</row>
</rows>

id 13 comes twice..
also i tried this sample with 10000 test rows and only 12. row is duplicate..

i think startPos parameter in the request is coming false on first scroll..
(
on first load url : getGridRecords.aspx?startPos=0&count=12
on first scroll url : getGridRecords.aspx?startPos=12&count=12
on second scroll url : getGridRecords.aspx?startPos=25&count=12
on third scroll url : getGridRecords.aspx?startPos=38&count=12
and so on..
)

sample code;

<div>
<div id="ctl02" style="width: 500px; height: 200px;">
</div>

<script>
var ctl02QString;
function SGOS(ind,gridObj,direct) {
ctl02.clearAll();
ctl02.loadXML(ctl02QString+(ctl02QString.indexOf('?')>=0?'&':'?')+'orderBy='+ind+'&direct='+direct);
ctl02.setSortImgState(true,ind,direct);
return false;
}
var ctl02 = new dhtmlXGridObject('ctl02');
ctl02.setImagePath('../Common/Components/Grid/imgs/');
ctl02.setHeader('Id,Product Name,Internal Code,Price,some');
ctl02.setInitWidths('*');
ctl02.setColAlign('Left');
ctl02.setColSorting('server');
ctl02.attachEvent('onBeforeSorting',SGOS);
ctl02.setSkin('light');
ctl02.init();
ctl02.enableSmartRendering(true);
ctl02QString='getGridRecords.aspx';
ctl02.load(ctl02QString);
</script>

</div>

how can i resolve this?

thanks in advance..
Answer posted by Support on Dec 29, 2008 17:27
The problem is in your server side code, it returns incorrect data on second call
Request is getGridRecords.aspx?startPos=12&count=12
    startPos=12 which mean output must start from position 12 , position is != id

In your case
id    pos
1      0
3      1
4      2
5      3
6      4
7      5
8      6
9       7
10      8
11      9
12      10
13      11
14      12

So position 12 is related to record with ID 14 ( record with ID 13 has position 11 and must not be outputed )
All other errors are result of incorrect data output ( dupplicate ID ) which may result in very different errors