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

Editing and Adding on Grid

Hi,
I am not able to reproduce this behavior in my grid layout.
I have a filed that when I want to add a new record is enabled in the Added row, and when is in edit is disabled.
I used the allowEditing property in field column definition, but this works in all the edit / add behavior.
What can I do?
Thanks in advance
Andrea Perazzolo

1 Reply

VA Venkatesh Ayothi Raman Syncfusion Team August 3, 2016 11:13 AM UTC

Hi Andrea, 

Thank you for contacting Syncfusion support. 

If we have set allowEditing false for particular column, then it disables both editing and adding operation in Grid. We have achieved your requirement using actionComplete event in Grid. In this event, we can check the condition while adding the record and remove the disabled attribute when we disable the allowEditing property for particular column. Please refer to the code example, Help document and sample, 

Code example: 
Grid 
$("#Grid").ejGrid({ 
                // the datasource "window.gridData" is referred from jsondata.min.js 
                dataSource: window.gridData, 
 
                allowFiltering: true, 
                allowPaging: true, 
                pageSettings: { pageSize: 7 }, 
 
                editSettings: { allowAdding: true, allowEditing: true, allowDeleting: true }, 
                toolbarSettings: { showToolbar: true, toolbarItems: ["search", "add", "edit", "delete", "update", "cancel"] }, 
 
                actionComplete: "actionComplete", 
 
                columns: [ 
                             { field: "OrderID", headerText: "Order ID", isPrimaryKey: true, width: 80 }, 
                             { field: "CustomerID", headerText: "Customer ID", allowEditing: false, width: 80 }, 
                             { field: "EmployeeID", headerText: "Employee ID", width: 80, editType: "dropdownedit" }, 
                             { field: "Freight", headerText: "Freight", width: 90, }, 
                             { field: "OrderDate", headerText: "OrderDate", width: 90 }, 
                             { field: "ShipName", headerText: "ShipName", width: 90 }, 
 
                ], 
 
 
            }); 
 
        }); 
 
actionComplete 
 
function actionComplete(args) { 
 
 
 
            if (args.requestType == 'add') { 
 
                var len = this.model.columns.length; 
 
                for (i = 0; i < len; i++) { 
                    if (args.model.columns[i]["allowEditing"] == false) 
 
                        $("#" + this._id + args.model.columns[i]["field"]).removeClass("e-disable").removeAttr("disabled");// Remvove the class and attribute for disabled column while adding the record 
                } 
 
            } 
        } 






Regards, 
Venkatesh Ayothiraman. 


Loader.
Up arrow icon