function updategrid2Count(preTopRow,value) {
//reset updategridIns row count label
var topRow, btmRow , selectedRows, selectedRow, selectOffset, newRow, x;
if (myData2.length == null || myData2.length == 0) {
grid2Count.setControlText("No Records");
} else {
topRow = Math.round((obj.getScrollTop()/18)+1);
btmRow = topRow + 4;
if (topRow < 1 || topRow > myData2.length || btmRow < 1 || btmRow > myData2.length ){
return;
}
if (btmRow > myData2.length) {
btmRow = myData2.length ;
}
grid2Count.setControlText(topRow + " - " + btmRow +" of " + (myData2.length));
}
topRow = topRow -1;
btmRow = btmRow -1;
selectedRows = obj.getSelectedRows();
if (selectedRows.length>0 ){
selectedRow = parseInt(selectedRows[0]);
// must deal with sorted rows
a = new Array();
a=obj.getRowIndices();
var i;
if (a == null || a =="" ){
selectOffset = selectedRow-preTopRow;
newRow = topRow+selectOffset;
//alert("PRE:"+topRow+"TOP:"+topRow+"SEL:"+selectedRow+"NEW:"+newRow);
} else {
for (x = 0; x < a.length; x++) {
if (a[x] == selectedRow){
break;
}
}
selectOffset = x-(preTopRow); //alert(x);
var nrIdx = topRow+selectOffset;
if (nrIdx>a.length -1) {nrIdx = x; }
if (nrIdx<0) {nrIdx = x;}
newRow = a[nrIdx];
}
obj.setSelectedRows([newRow]);
obj.setCurrentRow(newRow) ;
}
}
This topic is archived.