Disabling Columns On Individual Rows

Hi,
How can I disable columns on individual rows based on one of the properties in the row?
Based on certain conditions (set in the row) I want to disable editing specific columns per row.
Many thanks,

3 Replies

SA Saravanan Arunachalam Syncfusion Team October 31, 2017 05:49 AM UTC

Hi Avi, 
Thanks for contacting Syncfusion’s support. 
We have analyzed your requirement and achieved it by using ActionComplete event of Grid control. In that event, we have prevented the editing for the particular column from the currently edited row based on the certain condition (Disable the editing, if the EmployeeID is lessthan 5). Please refer to the below code example. 
@(Html.EJ().Grid<SyncfusionMvcApplication1.OrdersView>("FlatGrid") 
        . . . 
        .ClientSideEvents(e => { e.ActionComplete("onActionComplete"); }) 
      ) 
<script> 
    function onActionComplete(args) { 
        if (args.requestType == "beginedit" && args.rowData.EmployeeID < 5) { 
            //If the column has string edit 
            $("#GridFreight").addClass("e-disable"); 
            //If the column has numeric edit type 
            $("#GridFreight").ejNumericTextbox("disable");  
            //If the column has dropdown edit type 
            $("#GridFreight").ejDropDownList("disable");  
        } 
 
    } 
</script> 
 
And also refer to the below api reference links. 
Regards, 
Saravanan A. 



AS Avi Segal October 31, 2017 08:59 AM UTC

Perfect!

Thanks,



SA Saravanan Arunachalam Syncfusion Team November 1, 2017 04:02 AM UTC

Hi Avi,  
Thanks for your update.            
We are happy that the provided information helped you. 
Regards, 
Saravanan A. 


Loader.
Up arrow icon