EasyUI Forum
September 14, 2025, 09:46:09 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: focus editor on cellediting  (Read 15884 times)
iskandarkbr
Newbie
*
Posts: 36


View Profile Email
« 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
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: March 08, 2015, 08:20:11 PM »

Please try this updated example http://jsfiddle.net/2UXEM/4/
Logged
iskandarkbr
Newbie
*
Posts: 36


View Profile Email
« Reply #2 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
« Last Edit: March 08, 2015, 08:59:07 PM by iskandarkbr » Logged
iskandarkbr
Newbie
*
Posts: 36


View Profile Email
« Reply #3 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.
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #4 on: March 09, 2015, 12:31:04 AM »

If you are using datagrid, please use the 'onBeginEdit' event instead.
http://jsfiddle.net/2UXEM/5/
Logged
iskandarkbr
Newbie
*
Posts: 36


View Profile Email
« Reply #5 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]);

   
Logged
iskandarkbr
Newbie
*
Posts: 36


View Profile Email
« Reply #6 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;

   
Logged
iskandarkbr
Newbie
*
Posts: 36


View Profile Email
« Reply #7 on: March 09, 2015, 11:29:23 PM »

great!!!..i found

i just replaced $(this)" by $("#datagridname")...thanks stworthy
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!