Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
380
rowAdding event - Access the row
posted

name: "Updating",
locale: {
addRowLabel: "Add new..",
rowEditDialogCaptionLabel: "Add New"
},
enableAddRow: true,
enableUpdateRow: true,
enableDeleteRow: false,
editRowEnding: function (evt, ui) {
console.log(ui);
},
rowAdding: function (evt, ui) {
console.log(ui);
},

I am using the code above. I need to access the row that was added so I can set some values on field that were hidden from the user.

How can I do this?

Parents
No Data
Reply
  • 160
    Offline posted

    Hello William,

    After researching further the best way to change the added record and add value to the hidden columns is by binding to the editRowEnding event. Its ui param has values property which is an object which is the record which will be added in the dataSource array.

    editRowEnding: function (evt, ui) {
        if(ui.rowAdding) {
            ui.values["HiddenColumn"] = "default value";
        }
    },

    I have updated the sample I sent you. You can notice that the value for newly added record is set to “default value”.

    In case you have additional questions don’t hesitate to ask them.
    5076.changeHiddenCellsSample.zip

Children
No Data