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.

Editing and Adding on Grid

Thread ID:

Created:

Updated:

Platform:

Replies:

125244 Aug 2,2016 09:27 AM Aug 3,2016 07:13 AM JavaScript 1
loading
Tags: ejGrid
Andrea Perazzolo
Asked On August 2, 2016 09:27 AM

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

Venkatesh Ayothi Raman [Syncfusion]
Replied On August 3, 2016 07:13 AM

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. 


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.

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.

;