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

Grid Edition disabled on row, not on column

Hello,

I'im working on a grid which, in case of a specific value of a cell in the row, wouldn't authorize to edit this row.

I could only find a way to allowEditing on column but not on row.

Is there a documentation or sample regarding this subject ? I'm working with ES5.

Regards,
David.

3 Replies

HJ Hariharan J V Syncfusion Team April 4, 2019 12:05 PM UTC

Hi David, 

Thanks for contacting Syncfusion support. 

You can disable the editing for a particular row by using the actionBegin event of Grid based on requestType as beginEdit. We have prepared a sample for your requirement. Please find the below sample: 



Please get back to us if you need further assistance 

Regards, 
Hariharan 



DC David Caraiannis April 4, 2019 12:18 PM UTC

Hello,

Thanks for your answer.

Is there not an "allowEditing" like on columns but for rows ? If not, will there be in some future update ?


HJ Hariharan J V Syncfusion Team April 5, 2019 11:58 AM UTC

Hi David, 

Thanks for contacting us. 

Query: In the same column, some cells can be editable and some not. It all depends from the value of another cell in the same row. 
 
As per your requirement, we have created a sample for your reference. In the below sample, we need to bind actionBegin event, In that event based on the CustomerID value we can enable or disable editing for shipCountry column in Grid. 

Please check the below code example and sample for more information. 

var grid = new ej.grids.Grid({ 
        dataSource: window.orderDataSource, 
        editSettings: { allowEditing: true, allowAdding: true, allowDeleting: true, mode: 'Normal'}, 
        allowPaging: true, 
        pageSettings: { pageCount: 5 }, 
        toolbar: ['Add', 'Edit', 'Delete', 'Update', 'Cancel'], 
        actionBegin: actionBegin, 
        columns: [ 
            { 
                field: 'OrderID', isPrimaryKey: true, headerText: 'Order ID'                validationRules: { required: true, number: true }, width: 140 
            }, 
            { 
                field: 'CustomerID', headerText: 'Customer ID', 
                validationRules: { required: true }, width: 140 
            }, 
           { 
                field: 'ShipCountry', headerText: 'Ship Country', editType: 'dropdownedit', width: 150, 
                edit: { params: { popupHeight: '300px' } } 
            } 
        ], 
    }); 
    grid.appendTo('#Grid'); 
 
    function actionBegin(args) { 
        if (args.requestType === 'beginEdit') { 
           if(args.rowData.CustomerID.includes("V")){ 
             // enable and disable editing for shipCountry column 
             this.columns[2].allowEditing = true; 
           } else { 
             this.columns[2].allowEditing = false; 
           } 
        } 
    } 



Regards, 
Hariharan 


Loader.
Up arrow icon