I’me using dhtmlxScheduler an dhtmlxgrid with a datastore.
It is working very good, but I’ve problems with removing some records.
In following function there where deleted 2 records.
function urentotaal(){
var rowsCount = data2.dataCount();
for (var rInd = 0;rInd < rowsCount;rInd++) {
if (data2.item(data2.idByIndex(rInd)).type.toString()==‘AT’){
alert(data2.idByIndex(rInd));
data2.remove(data2.idByIndex(rInd));
}
}
plangrid.sync(data2);
}
records: b0000 and b2000 are deleted
If I remove “data2.remove(data2.idByIndex(rInd));” It shows 4 records.
records: b0000; b1000; b2000 and b3000 are shown
function urentotaal(i){
var rowsCount = data2.dataCount();
for (var rInd = 0;rInd < rowsCount;rInd++) {
if (data2.item(data2.idByIndex(rInd)).type.toString()=='AT'){
alert(data2.idByIndex(rInd));
if(i){ data2.remove(data2.idByIndex(rInd));
rInd--; // avoid jumping through one of the record
}
}
}
}