[ 2 posts ]

Akhila

  • Username: Nile
  • Joined: Wed Dec 21, 2011 7:54 am
  • Posts: 3
  • IRC: Akhi
  • Offline
  • Profile
Tags:

Navigating using Arrowkeys in Datatable

Post Posted: Thu Jan 05, 2012 6:35 am
+0-
Hi,

I have a datatable with one column of editable HTML input fields. I need to select the row using arrow keys. Once I use arrow keys for selecting the rows the cursor and row selection should move together.

Currently, if I navigate using Arrow keys the cursor will alone move. The row selection will remain at the place where I left and if I use Tab key to select the row, the cursor is remaining in the earlier location.

I am using rowClickEvent to select the rows as below:

DataTable.subscribe("rowClickEvent", function(evt){
DataTable.onEventSelectRow(evt);
var html = evt.target;
var trEls=DataTable.getSelectedTrEls();
var fields = YAHOO.util.Dom.getElementsByClassName("fieldname","input",trEls[0]);
fields[0].focus();
});

Can somebody please help me achieve this.

Thanks for help.

Todd Smith

YUI Contributor

  • Username: stlsmiths
  • Joined: Thu Nov 05, 2009 10:03 am
  • Posts: 675
  • GitHub: stlsmiths
  • Gists: stlsmiths
  • IRC: t_smith
  • Offline
  • Profile

Re: Navigating using Arrowkeys in Datatable

Post Posted: Thu Jan 05, 2012 8:02 am
+0-
Can't really recommend using HTML input elements in a DataTable, but if you really want to do this you could take a look at Satyam's example.

DataTable does not support "arrow key navigation" natively, it is not a Data Grid. It can be done, but will involve defining arrow key handlers using Event delegation.

Good luck!
  [ 2 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum