:: Forum >>

Is there a way to set the numbers or rows before scrolling?

I would like to set the grid in such a way that it allows 4 rows before scrolling and if greater that 4 rows, it starts to scroll. This is due to the size of my frame in one of my web pages.

Can anyone help??
Roger
Tuesday, November 22, 2005
is there a answer to this.

I am trying to display the row count on top of my grid as the user scrolls
as well as keep the relative row selected.
eg. if rows 1-5 of 20 are displayed and the seleted row is 3 then after scroll the couter may show 4-9 of 20 and the selcted row should be 6.

I kind of have this working .
The counter is an AW.UI.Label
And I call the following method on grid.onScrollTopChanged

The problem is that when the top or btm row is selected the scrollbar tends to 'do a dance' on fast scrolling.

Any Ideas

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) ;
}
}
Colin P.
Monday, October 23, 2006

This topic is archived.


Back to support forum

Forum search