Title: focus editor on cellediting Post by: iskandarkbr on March 08, 2015, 07:19:33 PM i've tried your code in http://jsfiddle.net/2UXEM/2/
but it still doesnot work what i plan is when i press enter on editor it focus on next field's editor P.S. i am using your cellediting Title: Re: focus editor on cellediting Post by: stworthy on March 08, 2015, 08:20:11 PM Please try this updated example http://jsfiddle.net/2UXEM/4/
Title: Re: focus editor on cellediting Post by: iskandarkbr on March 08, 2015, 08:52:04 PM actually i cant find onEdit event on datagrid.
its only on edatagrid. Why focus() method doesnt work on datagrid (not edatagrid), i try cell editing on datagrid Title: Re: focus editor on cellediting Post by: iskandarkbr on March 08, 2015, 09:22:35 PM function onClickCell(index, field){
if (endEditing()){ //console.log(endEditing()); $('#dg').datagrid('selectRow', index) .datagrid('editCell', {index:index,field:field}); editIndex = index; } var editor = $('#dg').datagrid('getEditor', {index:index,field:field}); editor.target.focus() } as you see above, i tried to modify your example, but the focus() dosnt work, it doesnt focus anywhere. Title: Re: focus editor on cellediting Post by: stworthy on March 09, 2015, 12:31:04 AM If you are using datagrid, please use the 'onBeginEdit' event instead.
http://jsfiddle.net/2UXEM/5/ Title: Re: focus editor on cellediting Post by: iskandarkbr on March 09, 2015, 02:39:38 AM var ed1 = $(this).datagrid('getEditor',{index:index,field:'idtemuan'});
var ed2 = $(this).datagrid('getEditor',{index:index,field:'listprice'}); var ed3 = $(this).datagrid('getEditor',{index:index,field:'unitcost'}); setKeydown([ed1.target,ed2.target,ed3.target]); it return TypeError: ed2 is null setKeydown([ed1.target,ed2.target,ed3.target]); Title: Re: focus editor on cellediting Post by: iskandarkbr on March 09, 2015, 09:04:18 PM i try this code :
onClickRow:function(rowIndex){ var editors=$(this).datagrid("getEditors",rowIndex); $(editors[0].target).combo('textbox').bind('keydown',function(e){ if(editors[0].field=='idtemuan'){ if(e.which==39){ console.log(editors[0].field); $(this).datagrid('selectRow', rowIndex); $(this).datagrid('editCell', {index: rowIndex,field: 'lisprice'}); } }else if(editors[0].field=='listprice'){ if(e.which==13){ console.log(editors[0].field); } }else if(editors[0].field=='unitcost'){ if(e.which==13||e.which==9){ console.log(editors[0].field); } } }); but it doesnot works, it said : TypeError: $.data(...) is undefined var opts=$.data(_675,"datagrid").options; Title: Re: focus editor on cellediting Post by: iskandarkbr on March 09, 2015, 11:29:23 PM great!!!..i found
i just replaced $(this)" by $("#datagridname")...thanks stworthy |