EasyUI Forum
April 26, 2024, 10:21:52 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: combotree in datagrid  (Read 6303 times)
iskandarkbr
Newbie
*
Posts: 36


View Profile Email
« on: March 06, 2015, 08:19:59 AM »

i've tried to add combotree as editor in datagrid. it works properly while we choose node in combotree.
the problem appear when i enter the cell to edit the data. the text on datagrid doesnt appear ini combotree's texbox.


{field:'productid',title:'Product',width:300,
                  formatter:function(value){
                     for(var i=0; i<datajson.length; i++){
                        if (datajson.id == value) return datajson.text;
                     }
                     return value;
                  },
                  editor:{
                     type:'combotree',
                     options:{
                        valueField:'id',
                        textField:'text',
                        method:'post',
                        url:'data/datajson.php',
                        loadFilter: function(rows){
                                    return convert(rows,'tree-temuan');
                                 },
                        required:true,
                        panelWidth:650
                     }
                  }
               },
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: March 06, 2015, 08:58:25 AM »

Please update the easyui to version 1.4.2. If you are using version 1.4.1, please refer to the code below to solve your issue.
Code:
$('#dg').datagrid({
    onBeginEdit: function(index,row){
        var ed = $(this).datagrid('getEditor',{index:index,field:'productid'});
        $(ed.target).combotree({
            url: '...',
            value: row.productid
        });
    },
    onEndEdit: function(index,row){
        var ed = $(this).datagrid('getEditor',{index:index,field:'productid'});
        row.productname = $(ed.target).combotree('getText');
    }
})
Logged
iskandarkbr
Newbie
*
Posts: 36


View Profile Email
« Reply #2 on: March 06, 2015, 06:31:14 PM »

great........(Y)...thanks alot stworthy , it works

what i did is i replace url option by data: datajson variable.

acctually i've tried this before:

var ed = $(this).datagrid('getEditor', {index:index, field:'productid'});
$(ed.target).combotree('setText','tes');
var t=$(ed.target).combotree("tree");
var node=t.tree('find','2');
t.tree('select',node.target);

but it always return null for the node
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!