Hi there,
I've hierarchical grid with 2 child grids and I'm saving child row records while calling my web service from editRowEnding. All records are saving in DB and on web service callback in my javascript file I don't want to rebind the grid to show new records like $("#GridTable").igHierarchicalGrid("dataBind");
And I'm using addRow and updateRow from API to show and updated NEW row record. I'm also getting back all records of NEW row from web service. Below is my piece of code which is not working as expected and showing an error:
CODE:
var result = $.parseJSON(data.d); var cols = { UserID: result.UserID, UnitRightID: result.UnitRightID, UnitRef: result.UnitRef, UnitName: result.UnitName, AccessRights: result.AccessRights, SwitchUnit: result.SwitchUnit, Inactive: result.Inactive }; if (SaveMode == 0) { $("#GridTable").igGridUpdating("addRow", cols); } else { $("#GridTable").igGridUpdating("updateRow", result.UnitRightID, cols); } $("#GridTable").igHierarchicalGrid("commit"); $("#GridTable").igHierarchicalGrid("saveChanges");
ERROR:
Unhandled exception at line 51, column 16899 in http://localhost:58799/js/infragistics.js?Version=1.0.020x800a138f - JavaScript runtime error: Unable to set property 'UnitRightID' of undefined or null reference
Pls Note: I'm using latest release 12.2.20122.2127 and getting correct values in UNitRightID (Primary Key of child grid).
Please advise any help?
Regards,
Jasdeep
Hello ecatenate ,
Thank you for posting I our forum.
Is ‘GridTable’ the id of the parent grid? If that’s the case the widget will try to update that value in the parent grid. If the parent grid does not have a column with name 'UnitRightID' that might be the reason you’re getting the error. If this code is inside the editRowEnding event you could try getting the updating widget for the current grid directly from ui.owner and calling it updateRow method. For example:
editRowEnded: function (evt, ui) {
var owner = ui.owner;
ui.owner.updateRow(ui.rowID, { … });
}
Let me know if that solves your issue.
Best Regards,
Maya Kirova
Developer Support Engineer II
Infragistics, Inc.
http://es.infragistics.com/support
Hi Maya,
Thanks very much for your quick response. I'll try your approach and let you know the out come.