Current filter:
                                You should refresh the page.
                                  • We have a grid that has some of the columns disabled by using a css class.
                                    When we add a new row, we want to remove the class being applied so that the cell is editable.
                                    The code written is not working correctly.

                                    The existing code looks like this:

                                    [JavaScript]
                                    function TaxBillGrid_BatchEditRowInserting(s, e) { var clientIndex = s.GetColumnByField("ClientId").index; $("#TaxBillGrid_tccellnew_" + clientIndex).removeClass(" NotEditableCssClass"); var taxYearIndex = s.GetColumnByField("TaxYear").index; var tdTaxYearIndex = $("#TaxBillGrid_DXHeadersRow0 #TaxBillGrid_col" + taxYearIndex).index() + 1; $("#TaxBillGrid_DXDataRownew td:nth-child(" + tdTaxYearIndex + ")").removeClass(" NotEditableCssClass"); }

                                    What would be the correct way to remove a class from a cell in a new row by its name?

                                    In other words, if I have a column with name "TaxYear", how would I remove a class applied to the column for just this cell?

                                • Marina (DevExpress Support) 01.14.2020

                                  Hi Jim,

                                  It is not clear why you need to use your own class to prevent column editing. In fact, you can use the approach illustrated in the GridView - Batch Editing - How to cancel editing or disable the editor conditionally sample. If it doesn't work for you for some reason, please modify that sample to illustrate your approach. I look forward to hearing from you.

                                • Jim Shaffer 01.14.2020

                                  I didn't write the code for this grid, and I am not planning on rewriting it all. We are upgrading from an old version of DevExpress and need to get the existing code working.
                                  How would you remove a class in the event above, for a specific column?
                                  Can you just provide an example of removing a class from a column within the batch edit row inserting client side event or is it not possible?

                                1 Solution

                                Creation Date Importance Sort by

                                Hello Jim,

                                I didn't write the code for this grid, and I am not planning on rewriting it all. We are upgrading from an old version of DevExpress and need to get the existing code working.

                                In your snippet, you are trying to assume rows' IDs, for example:

                                [JavaScript]
                                $("#TaxBillGrid_tccellnew_" + clientIndex).removeClass(" NotEditableCssClass");

                                Our algorithm to assign ids is not documented and can change from version to version without any notification. So, it is better to rewrite this code to make it stable and avoid new issues after the next upgrade. The correct approach is shown in the following thread: GridView - Batch Editing - How to cancel editing or disable the editor conditionally.

                                How would you remove a class in the event above, for a specific column?
                                Can you just provide an example of removing a class from a column within the batch edit row inserting client side event or is it not possible?

                                In v19.2.5, you need to use a negative row index instead of the "new" string to find new rows. This will help you form the correct selector. After this, the removeClass method will work correctly. I illustrated