EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: zh_CN on April 21, 2014, 01:38:11 AM



Title: combotree in row editor can define value and text property ?
Post by: zh_CN on April 21, 2014, 01:38:11 AM
..
{field: 'pid', title: '上级', width: 150, align: 'center', editor: {
                        type: 'combotree',
                        optons : {
                            url: '{:U("MDepartment/getJson")}',
                            valueField: "value", textField: 'name',
                        }
}},
...
Can't loading url data

ask:
can define value and text property ?



Title: Re: combotree in row editor can define value and text property ?
Post by: stworthy on April 21, 2014, 08:21:12 AM
You do not need to define 'valueField' and 'textField' in combotree plugin. The field value and display text will be auto retrieved from the drop-down tree.



Title: Re: combotree in row editor can define value and text property ?
Post by: zh_CN on April 21, 2014, 08:35:02 AM
You do not need to define 'valueField' and 'textField' in combotree plugin. The field value and display text will be auto retrieved from the drop-down tree.



Thanks you reply.

I see the demo.
the loading json:
[{
   "id":1,
   "text":"My Documents",
   "children":[{
      "id":11,
      "text":"Photos",
      "state":"closed",
      "children":[{
         "id":111,
         "text":"Friend"
      },{
         "id":112,
         "text":"Wife"
      },{
         "id":113,
         "text":"Company"
      }]
   },
...

BUT mine like:
[{
   "id":1,
   "name":"My Documents",   //this field. mine is "name" not "text"
   "children":[{
      "id":11,
      "text":"Photos",
      "state":"closed",
      "children":[{
         "id":111,
         "text":"Friend"
      },{
         "id":112,
         "text":"Wife"
      },{
         "id":113,
         "text":"Company"
      }]
   },
...


Title: Re: combotree in row editor can define value and text property ?
Post by: stworthy on April 21, 2014, 01:45:08 PM
Please use loadFilter function to convert your data to standard tree data.


Title: Re: combotree in row editor can define value and text property ?
Post by: zh_CN on April 21, 2014, 07:27:25 PM
Please use loadFilter function to convert your data to standard tree data.

Thank you your solution!

But now, I write the code follow, don'nt work fine:
...
                {field: 'id', title: 'ID编号', width: 50, align: 'center'},
                {field: 'name', title: '名称', width: 150, align: 'left',  editor:'text'},
                {field: 'pid', title: '上级', width: 150, align: 'center', editor: {
                        type: 'combotree',
                        optons : {
                            //url: '{:U("MDepartment/getJson")}',
                            url: 'http://www.jeasyui.com/demo/main/tree_data1.json',
                          
                            //valueField: "value", textField: 'name',  // And i hope combotree suport textField property
                        }
                    }},
...

When i edit the row, the combotree in the editor cang loading remote json.
Please see the attachment (100 is the field "pid" value);