We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Read only inline grid

Hi team,

How do I set some columns in an inline grid to be read only when adding a record? One of the columns in the grid has an edit type dropdown, the read only column value will be based on the value selected in the dropdown.



1 Reply

AR Ajith R Syncfusion Team January 15, 2016 03:50 AM UTC

Hi Lory,

Thanks for using Syncfusion products.

Query 1: How do I set some columns in an inline grid to be read only when adding a record? 

We suggest you to set allowEditing as false to the specific column to achieve the read only operation while adding new record in the Grid. Please refer the below code snippet for further details.

$("#Grid").ejGrid({

            ---------

            ---------

            columns: [

                    -----------

                    -----------

                    { field: "CustomerID", headerText: 'Customer ID', allowEditing: false, width: 90 }                   

            ]
        });


Query 2: One of the columns in the grid has an edit type dropdown, the read only column value will be based on the value selected in the dropdown.

We suggest you to use actionBegin client side event and check requestType as save then assign the read only column value in args.data based on the drop down column value to achieve your requirement. Please refer the below code snippet for further details.

$("#Grid").ejGrid({

            ---------

            ---------

            actionBegin: function (args) {

                if (args.requestType == "save") {

                    if (args.data.EmployeeID < 4) // check drop down column value

                        args.data.CustomerID = "ADAMS"; // set read only column value

                    else

                        args.data.CustomerID = "EVES";

                }

            }
        });


Please refer the below sample for further details.

http://jsplayground.syncfusion.com/pvzl1ehm

Please let us know if you have any further concerns.

Regards,
Ajith R

Loader.
Up arrow icon