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
igGrid Edit using form fields
posted

We have an igGrid on a form. The fields for adding a new record are placed below it with an "Add" button. The user enters values for a new record, clicks the "Add" button that executes this method:

        function AddRecord (e, ui)
        {
            var rowObj =
            {
                "SubRecordId": 0,
                "MainRecordId": recordId,
                "Product": $('#product').val(),
                "Notes": $('#notes').val(),
                "Cost": $('#cost').val().replace("$", "")
            };

            $('#grid').igGridUpdating('addRow', rowObj, true);
        }

Instead of editing the row "in place" in the grid cells, we want the user to click a row, fill the fields with the "editable" field values (Product, Notes, Cost) from the selected row, and have the "Add" button become an "Update" button.

We're able to add a record to the grid's igDataSource using the above method, but how would we update a selected row?

Parents
  • 49378
    posted

    Hello icssupport,

    Thank you for posting in the community.

    You can update the grid's UI by commiting the new data after adding a row, i.e:

         $("#grid").igGrid("commit");

Reply Children