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

Conditional AllowEditing ejGrid

Thread ID:

Created:

Updated:

Platform:

Replies:

119798 Aug 3,2015 09:07 AM UTC Aug 6,2015 09:53 AM UTC JavaScript 5
loading
Tags: ejGrid
Bruno Rodrigues
Asked On August 3, 2015 09:07 AM UTC

Hello,

there is any way to set allowEditing true or false depending on the value of an ejGrid field?

In the same grid I have records that can be edited but there are others that should not be able to edit. 


Thank you in advance.
Bruno Rodrigues

Isuriya Rajan [Syncfusion]
Replied On August 4, 2015 03:38 PM UTC

Hi Bruno,

You can achieve your requirement by using “allowEditing” property. AllowEditing column api is used to enable or disable editing for specific column.

$("#Grid").ejGrid({

. . . . . . . .

columns: [

{ field: "EmployeeID", headerText: 'Employee ID', textAlign: ej.TextAlign.Right, width: 80, allowEditing: false },

]

. . . . . . .

});

We have created a sample and the same can be downloaded from the following location:

Sample Link: http://www.syncfusion.com/downloads/support/directtrac/general/Grid_(2)264412475.zip

Please refer to the link below for how we can use AllowEditing property for grid columns.

Online Documentation Link: http://helpjs.syncfusion.com/js/api/ejgrid#members:columns-allowediting

Please try the above sample and let us know if it helps.

Regards,

Isuriya R



Bruno Rodrigues
Replied On August 4, 2015 08:26 PM UTC

Hi,
You didn't understand my problem.

Is not the field that must be disabled. It's a field with a specific value type.

For example. If I have a field with a Value > 0 It can be edited. If the Value < 0 It cannot.

Did I make myself clear?

But thank you very much for your answer :)

Isuriya Rajan [Syncfusion]
Replied On August 5, 2015 12:27 PM UTC

Hi Bruno,

Sorry about the inconvenience caused.

You can edit particular value filed in a row by enabling the batch editing in Grid. Your requirement can be achieved by CellEdit event, which will trigger once we edit the particular cell in the Grid. In that event we can able to check the condition and disable the edit operation for the specific cell.

$("#Grid").ejGrid({

               

                editSettings: { allowEditing: true, allowAdding: true, allowDeleting: true,editMode:"batch" },

               

                      . . . . . . .      

            cellEdit: function (args) {

                   if(args.value <= 3) // Can check the condition

                          args.cancel =true; // Disable the edit for a cell

                                   }

            });

We have created a sample and the same can be downloaded from the following location:

Sample Link: http://www.syncfusion.com/downloads/support/directtrac/119798/Grid1138322670.zip

Please try the above sample and let us know if it helps. If we misunderstood your query, please provide us clear information regarding your requirements. It will help us to provide the prompt solution.

Regards,

Isuriya R



Bruno Rodrigues
Replied On August 5, 2015 08:45 PM UTC

Isuriya Rajan,
thank you very much for your fast reply!
That's what I needed! Thank you!

Isuriya Rajan [Syncfusion]
Replied On August 6, 2015 09:53 AM UTC

Hi Bruno,
Thanks for the update.
Please get back to us if you have any further queries.
Regards,
Isuriya 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

;