EasyUI Forum
May 17, 2024, 09:18:44 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: combotree in row editor can define value and text property ?  (Read 12605 times)
zh_CN
Newbie
*
Posts: 32



View Profile Email
« 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 ?

« Last Edit: April 21, 2014, 07:04:20 AM by zh_CN » Logged

From the great China
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 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.

Logged
zh_CN
Newbie
*
Posts: 32



View Profile Email
« Reply #2 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"
      }]
   },
...
Logged

From the great China
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #3 on: April 21, 2014, 01:45:08 PM »

Please use loadFilter function to convert your data to standard tree data.
Logged
zh_CN
Newbie
*
Posts: 32



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


 
« Last Edit: April 21, 2014, 07:33:38 PM by zh_CN » Logged

From the great China
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!