:: Forum >>
How to detect that last row is reached
Is it possible to detect when the last row is reached?
I want to populate the grid with new rows when key-down is pressed and the last row is already selected (paging).
Sunday, February 1, 2004
You need to set a handler for the "selectionChanged" action, retrieve an index of the selected row ("selection/index") and compare with the index of the last row.
function myAction(){
var index = this.getProperty("selection/index");
var count = this.getProperty("row/count");
var lastRow = this.getProperty("row/value", count-1);
if (index == lastRow){
// request more data
};
}
obj.setAction("selectionChanged", myAction);
Unfortunately I just found a bug - selection/index is set only after selectionChanged action :-( so the example above will not work until I fix that in 0.2.5 (or you can run it with window.setTimeout)
Alex (ActiveWidgets)
Monday, February 2, 2004
I had to set custom row-id's which are identical with the row-id's (keys) in my database.
In this case "this.getProperty("selection/index")" doesn' t return the rownumber of the grid - it returns my database-keys.
In my opinion there shouldn't be a "selectionChanged"-Event fired when the last row is reached and "key-down" is pressed. I'd like to have something lika a "lastRowReached"-Event and "firstRowReached"-Event.
Wolfgang
Tuesday, February 3, 2004
This topic is archived.
Back to support forum
Forum search