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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to implement readonly-fields?

Thread ID:





126266 Oct 4,2016 09:10 PM UTC Oct 5,2016 07:39 AM UTC JavaScript 1
Tags: ejGrid
Michael Baas
Asked On October 4, 2016 09:10 PM UTC

I have a simple ejGrid with a name-field (editType: ej.Grid.EditingType.String) and a computed field that the user should not be able to update. Searching the forum I found that suggestion to cancel the edit-Event, but I'd rather have this field greyed out and not even appear to be touchable. Is there something like a field-type "readOnly", "disabled", "Label" or similar? (I know I could define a template which does not have that field - but why should it be made so "difficult", when a simple fieldtype would be enough? ;-)

Mohammed Farook J [Syncfusion]
Replied On October 5, 2016 07:39 AM UTC

Hi Michael, 

Thanks for contacting Syncfusion Supports. 

If we want to make read only field , we need to set “allowEditing” as false at field description in column level. Please find the code example. 

        // the datasource "window.gridData" is referred from jsondata.min.js 
        dataSource: window.gridData, 
        allowPaging: true, 
        editSettings: { allowEditing: true, allowAdding: true, allowDeleting: true }, 
                columns: [ 
                 { field: "OrderID", isPrimaryKey: true, headerText: "Order ID", textAlign: ej.TextAlign.Right, validationRules: { required: true, number: true }, width: 90 }, 
                 { field: "CustomerID", headerText: 'Customer ID', validationRules: { required: true, minlength: 3 }, width: 90 }, 
                 { field: "EmployeeID", headerText: 'Employee ID', editType: ej.Grid.EditingType.Dropdown, textAlign: ej.TextAlign.Right, width: 80, validationRules: { number: true, range: [0, 1000] } }, 
                 { field: "Freight", headerText: 'Freight', textAlign: ej.TextAlign.Right, editType: ej.Grid.EditingType.Numeric, editParams: { decimalPlaces: 2 }, validationRules: { range: [0, 1000] }, width: 80, format: "{0:C}" }, 
          { field: "ShipName", headerText: 'Ship Name', width: 150, allowEditing: false }, 
          { field: "ShipCountry", headerText: 'Ship Country', allowEditing: false, width: 90 } 

For your reference , please find the sample and UG. 

J.Mohammed Farook 


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.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

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