dojo - Programmatically set dgrid row as active -
i'm trying programmatically set dgrid row active, not selected. have dojo dgrid ondemandlist
using selection
, keyboard
mixins.
using select(row)
method can programmatically select given row, row not active. when row active, can use , down arrow keys navigate rows above , below it. when row selected, row highlighted arrows keys not work.
clicking row mouse make active , selected, i'm trying build interface 100% usable keyboard.
ok, took me awhile got figured out. trying add focus row. code doing in dgrid/keyboard.js
under _focusonnode
method.
the actual code change focus row currentfocusednode
row focusednode
is:
if(currentfocusednode){ // clean previously-focused element // remove class name , tabindex attribute put(currentfocusednode, "!dgrid-focus[!tabindex]"); if(has("ie") < 8){ // clean after workaround below (for non-input cases) currentfocusednode.style.position = ""; } } if(has("ie") < 8){ // setting position relative magically makes outline // work focusing later on old ie. // (can't done priori css or screws entire table) focusednode.style.position = "relative"; } focusednode.tabindex = grid.tabindex; focusednode.focus(); put(focusednode, ".dgrid-focus");
the code above code fragment, work have declare "dojo/has"
, "put-selector/put"
first define currentfocusednode
, focusednode
. i'm leaving exercise reader ;-)
also note changes "focus", not select focusednode
can done using grid.select(focusednode);
Comments
Post a Comment