3.2.0

get next grid row after sort

how do i get the next row after the selected row when the grid has been sorted. I have up and down arrows to navigate the grid and they ignore
the sort.

I have code using the 'selected/index' but this doesnt change with the sort order.

i have

1
2 <
3
4
5

my next row function works.

after sort

3
1
2 <
5
4

next row still goes to item 3 when it should go to item 5,

I am sure this is a simple fix, but i haven't been able to figure it out.

this is a mighty fine widget! top notch kit.



eldiablo
August 17,
Found it. i looked at the code for the keyup and keydown handling in grid.js

came up with this and it works a treat.

function nextrow(){
stepRow(1);
}

function prevrow(){
stepRow(-1);
}

function stepRow(step) {

var index = grid.getSelectionProperty("index");
var order = grid.getRowProperty("order", index );
var count = grid.getRowProperty("count");
var newOrder = Number(order) + step;

if (newOrder<0) {newOrder = 0}
if (newOrder>count-1) {newOrder = count-1}

var newIndex = grid.getRowProperty("value", newOrder);
grid.setSelectionProperty("index", newIndex);

}
eldiablo
August 18,

This topic is archived.

See also:


Back to support forum