Articles in this section

How to enable editing for disabled columns in tree grid while adding a record

In TreeGrid, editing operation in columns can be restricted by setting the AllowEditing property to false in the columns. This will restrict users from providing the column values while adding a new record.

You can make the disabled columns as editable while adding a new record by using the ActionBegin and ActionComplete client-side events.

The following code example explains the above use case.

<ej:TreeGrid runat="server" ID="TreeGridSelfReference" ActionBegin="actionBegin"IdMapping="Id" ActionComplete="actionComplete" > 
<Columns> 
<ej:TreeGridColumn HeaderText="Task Id" Field="Id" Width="60" EditType="Numeric" /> 
<ej:TreeGridColumn HeaderText="Task Name" Field="Name" EditType="String"AllowEditing="false"/> 
<ej:TreeGridColumn HeaderText="Start Date" Field="StartDate" EditType="Datepicker"/> 
<ej:TreeGridColumn HeaderText="Duration" Field="Duration" EditType="Numeric" /> 
<ej:TreeGridColumn HeaderText="Progress" Field="PercentDone" EditType="Numeric"AllowEditing="false" /> 
</Columns>             
</ej:TreeGrid> 
<script> 
function actionComplete(args) { 
if (args.requestType == "addNewRow") { 
args.model.columns[1].allowEditing = false; 
args.model.columns[4].allowEditing = false; 
} 
} 
function actionBegin(args) { 
if (args.requestType = "add") { 
args.model.columns[1].allowEditing = true; 
args.model.columns[4].allowEditing = true; 
} 
} 
</script>

Click here to find the sample to enable the editing operation for disabled columns while adding a new record.

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied