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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Read only inline grid

Thread ID:

Created:

Updated:

Platform:

Replies:

121671 Jan 14,2016 03:51 PM Jan 14,2016 10:50 PM JavaScript 1
loading
Tags: ejGrid
Lory
Asked On January 14, 2016 03:51 PM

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.



Ajith R [Syncfusion]
Replied On January 14, 2016 10:50 PM

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

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;