:: Forum >>

How do I execute clicking on a specific cell through JS?

Specifically I'm trying to have a keyboard event (SpaceBar) excecute a click on a checkbox that is in the first column of the current row.

Sorry if this is a simple question but I'm new to this and just found this component a couple days ago.

By the way thanks for a great component.
Tim
Monday, May 10, 2004
Sorry, Never mind. I found something that seems to work for what I need. If anyone has any comments on what I found they would still be appreciated. Thanks.

Here is what I am using:


document.getElementById(this.getRowTemplate(this.getSelectionProperty("index")).getItemTemplate(0).getId()).children[0].click()
Tim
Monday, May 10, 2004
The grid has trapped keydown events inorder to move the row selection with the arrow keys. If you can live without this feature, you can reenable key down events by calling

grid.setEvent("onkeydown", null);

In which case you can use tab and spacebar keys for manipulating form elements as normal.

gbegley
Monday, May 10, 2004
Thanks for the reply,

I'm actually keeping the default functionality and adding my own for specific keys with the following code:

var defaultEventHandler = obj.getEvent("onkeydown");

var myEventHandler = function(event){
if(event.keyCode==32){
document.getElementById(this.getRowTemplate(this.getSelectionProperty("index")).getItemTemplate(0).getId()).children[0].click();
}
else{
defaultEventHandler.call(this, event);
}
}
obj.setEvent("onkeydown", myEventHandler);
Tim
Monday, May 10, 2004
You can replace
document.getElementById(template.getId());
with
template.element();
Alex (ActiveWidgets)
Monday, May 10, 2004
i am new to this i cann't understand this please give me a example
jeeva
Wednesday, October 5, 2005
how can i manipulate data grid using aero key
vikas chaturvedi (DELHI)
Sunday, August 6, 2006

This topic is archived.


Back to support forum

Forum search