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
820
Set rowEdit updated using code
posted

Hello,

I am using a rowEditDialog for my grid row editing with some grid "bound" fields.

I also have other fields, such as a file upload, and checkboxes in the dialog.

I want to be able to set the ui.update property to true in the editRowEnded event if some of the other, non-grid bound values are changed.

If a user uploads a file to the file upload and click the 'done' button, i want to be able to have the ui.update property set to true in the editRowEnded event.  I attempted to set a hidden value in the grid when this occurs, but for some reason, it is not setting the value and the ui.update is not set to true(using $("#grid").igGridUpdating("updateRow", _rowId, { UploadedDocument: true }))

.  Is there a way i can force the ui.update property to true with code.  Below are some of the events used.

$(uiElements.Upload).igUpload({
mode: 'single',
width: 500,
labelUploadButton: "Select File",
labelAddButton: "Select File",
autostartupload: false,
allowedExtensions: ["pdf"],

 fileSelected: function (evt, ui) {

$("#grid").igGridUpdating("updateRow", _rowId, { UploadedDocument: true })

}

});

editRowEnded: function (event, ui) {
if (ui.update)

...
}

  • 485
    Offline posted

    Hello Ben,

     

    Thank you for posting in our forum.

     

    Ui.update is just a boolean variable that shows if some changes have been made to the currently edited row (which would cause update in the dataSource as well), but It doesn’t enable/disable those updates. When you call he API “updateRow” method: $("#grid").igGridUpdating("updateRow", _rowId, { UploadedDocument: true }) it would set a new value to the given cell and update the datasource as well as the UI, but it would not raise the rowEditEnded event.

     

    If the row being updated is currently in edit mode then the new value would be set to the current editor - the startEdit method could be used for the purpose. Calling “endEdit” afterwards would not only raise the event that you use, but the ui.update would be true, because the update didn’t happen by using the API only. Please note that the last parameter of “startEdit” should be set to true so that the Updating raises the “updateRow” event. Try changing the fileSelected event handler code to something like:

     

    fileSelected: function (evt, ui) {

                           $("#grid").igGridUpdating("startEdit", _rowId, " UploadedDocument", true);

                           $("#grid").igGridUpdating("updateRow", _rowId, { UploadedDocument: true })

                           $("#grid").igGridUpdating("endEdit", _rowId, " UploadedDocument");

                       }

     

    In case I have misunderstood your requirement, I would appreciate if you provide some more details on what that “hidden value” that you need to set in the grid is and why do you need to set ui.update to true? Also which version of Ignite UI do you use? I noticed there are two options in your code – “labelUploadButton” and “labelAddButton” that have been removed since version 17.2?

     

    If you need any additional assistance, feel free to contact me.