EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: diptendu on August 05, 2015, 10:41:41 PM



Title: Data grid column cannot be made editable
Post by: diptendu on August 05, 2015, 10:41:41 PM
Hello,

I am trying to make a datagrid column editable using a combobox.
However, the column is not becoming editable. The code is given below.

Thanks.

============================================================
<!DOCTYPE html>
<html>
<head>
   <meta charset="UTF-8">
   <title>The Analytic Platform - Home Page</title>
   <link rel="stylesheet" type="text/css" href="themes/default/easyui.css">
   <link rel="stylesheet" type="text/css" href="themes/icon.css">
   <script type="text/javascript" src="js/jquery.min.js"></script>
   <script type="text/javascript" src="js/jquery.easyui.min.js"></script>
   
   
</head>
<body>
   
     <script>
      var dataTypeArray = [ {typeValue:'1',typeName:'INTEGER'},
                            {typeValue:'2',typeName:'STRING'},
                            {typeValue:'3',typeName:'NUMERIC'},
                            {typeValue:'4',typeName:'DATE'}
                          ];
    </script>
   
   <table class="easyui-datagrid" title="Excel File Column Information">
      <thead>
         <tr>
            <th data-options="field:'a'">Column Number</th>
            <th data-options="field:'b'">Column Name</th>
            <th data-options="field:'c',
                     editor:{
                                     type:'combobox',
                                     options:{
                                            valueField:'typeValue',
                                            textField:'typeName',
                                            data:dataTypeArray,
                                            required:true,
                                            editable:false
                                        }
                  }">Data Type</th>
            <th data-options="field:'d'">Variable Type</th>
            <th data-options="field:'e'">No. of Rows</th>
         </tr>
      </thead>
      <tbody>
               <tr>
                     <td>1</td><td>Col1</td><td>STRING</td><td>TODO</td><td>15</td>
               </tr>
           </tbody>
       </table>
   
</body>
</html>


Title: Re: Data grid column cannot be made editable
Post by: jarry on August 06, 2015, 03:29:39 AM
Please call 'beginEdit' method to edit a row.


Title: Re: Data grid column cannot be made editable
Post by: diptendu on August 06, 2015, 05:48:22 AM
Hello,

I have added modified the page by adding a data-options for the 'onClickRow' event but still
not able to edit the row.

<table class="easyui-datagrid" data-options="onClickRow: function(indexRow){beginEdit(indexRow)}" "title="Excel File Column Information">
      <thead>
                  ......


Title: Re: Data grid column cannot be made editable
Post by: jarry on August 06, 2015, 06:00:01 AM
You used a wrong call. Please try this:
Code:
onClickRow: function(index, row){
$(this).datagrid('beginEdit', index);
}