EasyUI Forum
May 30, 2024, 02:24:05 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: [SOLVED]Combo Box inside TreeGrid  (Read 4373 times)
raghav94
Newbie
*
Posts: 9


View Profile
« on: June 25, 2017, 09:13:10 AM »

My data is being fetched from a JSON and being put in a TreeGrid.
I am trying to make one of the columns as a combox but only the first row gets converted.
I am using the coloumn formatter but clearly I am doing something wrong.
Attaching a screenshot as well.
Following is the code where I use the formatter:

function initializeTree(testsuiteArray){
        $('#test').treegrid({
            data : testsuiteArray,
            idField : "id",
            treeField : "tsName",
            fitColumns : true,
            resizeHandle : "right",
            checkbox: "true",
            loadMsg : "Processing, please wait …",
          //  multiSort: "true",
            order: "asc",
         //   sortName: "tsName",
            // remoteSort: true,
            columns:[[
                {field:'tsName',title : 'Testsuites',width:"20%",sortable:true},
                {field:'exeplatform',title : 'Exec PlatForm',width:"30%",
                    formatter: function(){
                        return '<select id="cc" class="easyui-combobox" name="dept" style="width:200px" multiple=true;>' +
                                    '<option value="aa">aitem1</option>' +
                                    '<option>bitem2</option>' +
                                    '<option>bitem3</option>' +
                                    '<option>ditem4</option>' +
                                    '<option>eitem5</option>' +
                                '</select>';
                    }
                },
                {field:'exetype',title : 'Exe Type',width:"20%"},
                {field:'runon',title : 'Runon',width:"20%",sortable:true},
                {field:'thread',title : 'Thread',width:"10%"}
            ]]
      
        });


Any help would be much appreciated.
« Last Edit: June 29, 2017, 02:51:50 AM by raghav94 » Logged
jarry
Administrator
Hero Member
*****
Posts: 2264


View Profile Email
« Reply #1 on: June 26, 2017, 07:57:25 AM »

When load data successfully, please create the combobox components manually.
Code:
$('#test').treegrid({
onLoadSuccess: function(){
$(this).treegrid('getPanel').find('.easyui-combobox').each(function(){
$(this).combobox();
})
}
})
Logged
raghav94
Newbie
*
Posts: 9


View Profile
« Reply #2 on: June 29, 2017, 02:38:06 AM »

It worked.
Thank you  Grin
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!