EasyUI Forum
May 14, 2024, 05:23:23 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] Editing a cell onClick TreeGrid  (Read 5005 times)
raghav94
Newbie
*
Posts: 9


View Profile
« on: June 25, 2017, 04:22:30 PM »

I am trying to get a cell edited on being clicked.
I have tried-

 $('#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%",sortable:true,
                    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%",sortable:true},
                {field:'runon',title : 'Runon',width:"20%",sortable:true,editor:'text'},
                {field:'thread',title : 'Thread',width:"10%",editor:{type:'numberbox'},sortable:true}
            ]],
        });

AND THIS


onClickCell:function(field,row){
                console.clear();
                console.log("in");
                if (field === 'thread'){

                    console.log("if");                // in and if get printed on the console
                    field.editor = 'numberbox';
                }
                else{
                    console.log("null");
                    field.editor = null;
                }


            }


Both aren't working. Embarrassed

 
« Last Edit: June 29, 2017, 02:52:38 AM by raghav94 » Logged
jarry
Administrator
Hero Member
*****
Posts: 2264


View Profile Email
« Reply #1 on: June 26, 2017, 08:02:01 AM »

You should call 'beginEdit' method to begin editing a row. Please refer to this example https://www.jeasyui.com/demo/main/index.php?plugin=TreeGrid&theme=default&dir=ltr&pitem=Editable%20TreeGrid&sort=
Logged
raghav94
Newbie
*
Posts: 9


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

Worked!!
Thanks Smiley
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!