javascript - infragistics webdatagrid get selected cell from keydown event in client side -
i have build infragistics webdatagrid in c# :
var columnone = new bounddatafield(); columnone.datafieldname = "columnone"; columnone.key = "columnone"; columnone.header.text = "columnone"; var columntwo = new bounddatafield(); columntwo.datafieldname = "columntwo"; columntwo.key = "columntwo"; columntwo.header.text = "columntwo"; webdatagridobject.datakeyfields = "columnone"; webdatagridobject.columns.add(columnone); webdatagridobject.columns.add(columntwo);
i javascript update cell column 2 when typed in cell column one.
for example, user starts typing value in cell @ line 3 , column one, cell @ line , column 2 must automatically updated constant value, "updated".
to that, bit struggling, have attach lot of client events c#, , think 1 usefull keydown :
webdatagridobject.clientevents.mousedown = "webdatagridview_mousedown"; webdatagridobject.clientevents.keydown = "webdatagridview_keydown"; webdatagridobject.behaviors.editingcore.behaviors.cellediting.celleditingclientevents.enterededitmode = "enterededitmode"; webdatagridobject.behaviors.editingcore.behaviors.cellediting.celleditingclientevents.exitededitmode = "exitededitmode";
i js keydown event handler, getting column key of cell edited, , if it's equals "columnone", update value of cell @ same line , on column two. js :
function webdatagridview_keydown(webdatagrid, evntargs) { } function webdatagridview_mousedown(webdatagrid, evntargs) { // trying column key of edited cell webdatagrid.get_behaviors().get_selection().get_selectedrowsresolved() [0].get_cell(3).get_text() } var gridref; var cellref; function enterededitmode(grid, args) { gridref = grid; cellref = args.getcell(); if (cellref._column._key === "headername") { alert('toto'); } } function exitededitmode(grid, args) { gridref = null; cellref = null; }
to column key, should try this:
webdatagrid.get_behaviors().get_selection().get_selectedrowsresolved()[0].get_cell(3).get_column().get_key();
or this:
webdatagrid.get_behaviors().get_selection().get_selectedrowsresolved()[0].get_cell(3).get_column()._datafieldname
Comments
Post a Comment