:: Forum >>

Fire KeyUp/KeyDown event.

Hi everybody!

I'm a newbie using this grid but I must confess that it's really awsome!!!

I'm developing an application that has a toolbar. This toolbar has four buttons intended to move across the records (first, previous, next, last)shown in the grid.

Actually I don't have any idea how to fire these events on the grid. I've been looking the forum's message and got nothing. I know that it's possible 'cause the grid does it by itself when I press the Up and Down keys, that it is what I really need: to fire those events but from an input item such as a command button or an image click event.

Thank you very much.
Pedro Mora
pedro.mora@smisistemas.net

jinxs_78
Wednesday, March 8, 2006
Hi.

I reply to myself.

I found in the forums a message posted by eldiablo where I could note a solution to change te current row programatically. Just add the function below to the grid engine (grid.js) and call it from your javascript code. The argument STEP determines the number of rows to move from the current position. If this value is positive the current row goes forward, otherwise goes backward.

function stepRow(step) {
var index = obj.getSelectionProperty("index");
var order = obj.getRowProperty("order", index );
var count = obj.getRowProperty("count");
var newOrder = Number(order) + step;
if (newOrder<0) {newOrder = 0}
if (newOrder>count-1) {newOrder = count-1}
var newIndex = obj.getRowProperty("value", newOrder);
obj.setSelectionProperty("index", newIndex);
}

Therefore, I made the function below to move to a sepecific row in the grid. For example, if you need to go to row 3 (no matter where the current row bookmark is) just call this function as f_ir_a(3).

function f_ir_a(p_numero){
var lv_pos = obj.getSelectionProperty("index");
var lv_nuevo_pos = (p_numero - lv_pos)-1;
stepRow(lv_nuevo_pos);
}

Thanks to everyone!
This grid is great!

-------------------
Viva VENEZUELA!!!
jinxs_78
Thursday, March 9, 2006
function stepRow(step) {
var index = obj.getSelectionProperty("index");
var order = obj.getRowProperty("order", index );
var count = obj.getRowProperty("count");
var newOrder = Number(order) + step;
if (newOrder<0) {newOrder = 0}
if (newOrder>count-1) {newOrder = count-1}
var newIndex = obj.getRowProperty("value", newOrder);
obj.setSelectionProperty("index", newIndex);
}
venkat
Thursday, March 23, 2006

This topic is archived.


Back to support forum

Forum search