EasyUI Forum
September 14, 2025, 01:20:10 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: multiSelect row ctrl and cellediting  (Read 17687 times)
iskandarkbr
Newbie
*
Posts: 36


View Profile Email
« on: March 12, 2015, 12:27:39 AM »

is your http://www.jeasyui.com/easyui/plugins/jquery.datagrid.js conflict with cellEditing below?
becouse when i included your jquery.datagrid.js it said "TypeError: value is undefined" for the numeric field that i define its formatter.


$.extend($.fn.datagrid.methods, {
   editCell: function(jq,param){
      return jq.each(function(){
         var opts = $(this).datagrid('options');
         //console.log(opts);
         var fields = $(this).datagrid('getColumnFields',true).concat($(this).datagrid('getColumnFields'));
         for(var i=0; i<fields.length; i++){
            var col = $(this).datagrid('getColumnOption', fields);
            col.editor1 = col.editor;
            if (fields != param.field){
               col.editor = null;
            }
         }
         $(this).datagrid('beginEdit', param.index);
         var ed = $(this).datagrid('getEditor', param);
         if (ed){
            if ($(ed.target).hasClass('textbox-f')){
               var str=$(ed.target).textbox('getText');
               $(ed.target).textbox('textbox').setSelection(0,str.length);
               $(ed.target).textbox('textbox').focus();
            } else {
               $(ed.target).focus();
            }
         }
         for(var i=0; i<fields.length; i++){
            var col = $(this).datagrid('getColumnOption', fields);
            col.editor = col.editor1;
         }
      });
   },
   enableCellEditing: function(jq){
      return jq.each(function(){
         var dg = $(this);
         var opts = dg.datagrid('options');
         opts.oldOnClickCell = opts.onClickCell;
         opts.onClickCell = function(index, field){
            if (opts.editIndex != undefined){
               if (dg.datagrid('validateRow', opts.editIndex)){
                  dg.datagrid('endEdit', opts.editIndex);
                  opts.editIndex = undefined;
               } else {
                  return;
               }
            }
            dg.datagrid('selectRow', index).datagrid('editCell', {
               index: index,
               field: field
            });
                     
            opts.editIndex = index;
            opts.oldOnClickCell.call(this, index, field);
         }
      });
   }
});
« Last Edit: March 12, 2015, 01:15:04 AM by iskandarkbr » Logged
iskandarkbr
Newbie
*
Posts: 36


View Profile Email
« Reply #1 on: March 12, 2015, 01:32:41 AM »

when i use --> url:'datajson.php' it problem on its value formatter.
but when i use variabel var dataGrid={"total":28,"rows":[..........]} it doesnt problem
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #2 on: March 12, 2015, 02:29:52 AM »

How do you declare your numeric editor and the 'formatter' function? Please show your code snippets out.
Logged
iskandarkbr
Newbie
*
Posts: 36


View Profile Email
« Reply #3 on: March 12, 2015, 02:36:29 AM »

here my field definision

{field:'unitcost',title:'Unit Cost',width:80,align:'right',editor:'numberbox',
   formatter:function(value, row){
         var strAngka=value.toString();
         return (strAngka);
   }
},
Logged
aswzen
Sr. Member
****
Posts: 287


Indonesian

aswzen
View Profile WWW Email
« Reply #4 on: March 12, 2015, 02:43:26 AM »

i don't know what is going on in 1.4.2 but before updated this console.log code

Quote
formatter:function(value, row, index){
         console.log(value);
         return (value);
   }

will return the value normally..but now it will return error like "TypeError: value is undefined"

by the way you can solve this problem with this code
Quote
formatter:function(value, row, index){
         console.log(value+"");
         return (value);
   }

and on your code will be
Quote
{field:'unitcost',title:'Unit Cost',width:80,align:'right',editor:'numberbox',
   formatter:function(value, row){
         var strAngka=value+'';
         return (strAngka);
   }
}

well :/
« Last Edit: March 12, 2015, 02:46:15 AM by aswzen » Logged

Regards,
Sigit

- Indonesian jEasyUI Facebook page : https://www.facebook.com/groups/jeasyuiid/
iskandarkbr
Newbie
*
Posts: 36


View Profile Email
« Reply #5 on: March 12, 2015, 02:47:19 AM »

i tried to modify your example, i replace data:data by url:'data_json.php'
Logged
iskandarkbr
Newbie
*
Posts: 36


View Profile Email
« Reply #6 on: March 12, 2015, 02:55:03 AM »

i'ved tried your trick value+'' , its works.
i think , maybe, toString() is the problem Smiley Smiley
Logged
iskandarkbr
Newbie
*
Posts: 36


View Profile Email
« Reply #7 on: March 12, 2015, 06:28:44 PM »

it seems, now, your new jquery.datagrid.js error while execute 'enableCellEditing' function

TypeError: $.fn.datagrid.methods[_195] is not a function
return $.fn.datagrid.methods[_195](this,_196);

does it conflict among your EasyUI 1.4.2 and 1.4.1 when i include it together. i made function for combotree (in 1.4.1), but it not execute in 1.4.2
« Last Edit: March 12, 2015, 06:47:05 PM by iskandarkbr » Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #8 on: March 12, 2015, 06:59:55 PM »

Please try the attached example 'test.html'. It works fine.
Logged
iskandarkbr
Newbie
*
Posts: 36


View Profile Email
« Reply #9 on: March 18, 2015, 08:12:44 PM »

its not work after datagrid.js combine with editdatacell..js
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!