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.

Update Cell

Thread ID:

Created:

Updated:

Platform:

Replies:

120551 Sep 24,2015 04:19 PM Sep 25,2015 02:38 AM JavaScript 1
loading
Tags: ejGrid
Lory
Asked On September 24, 2015 04:19 PM

Hi Team,

I understand you could update a record in the grid using updateRecord(fieldName, data).
But is there a way to update just a single cell in the record? 

I have a inventory grid set on "batch" edit mode, and I want it set so that the value of one cell changes based on the value edited on the other.

Is that possible? Thanks



Gowthami V [Syncfusion]
Replied On September 25, 2015 02:38 AM

Hi Lory,

Thanks for contacting Syncfusion support.

We can achieve your requirement by using “setCellValue” method of the grid as follows,

<script type="text/javascript">

        $(function () {
            $("#Grid").ejGrid({
. . . .
. . . .
editSettings: { allowEditing: true, allowAdding: true, allowDeleting: true, editMode: "batch" },
. . . .
. . . .

cellSave: function (args) {

                    if (args.columnName == "EmployeeID" && args.value == 5) {

//Getting the index of the edited cell row

                        var index = this.getIndexByRow(args.cell.parent());

//Updating the cell value of the Freight column

                        this.setCellValue(index, "Freight", 0);

                       

                    }

                }

            });

        });
    </script>


We have created a sample with your requirement like editing the EmployeeID column cell has value “5” then the Freight column cell value will be updated as “0” using setCellValue method of the grid.

Please refer the below link for the sample demo,

http://jsplayground.syncfusion.com/flkkd10c

Regards,
Gowthami V.

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.

;