$(document).on("iggridupdatingroweditdialogafteropen", "table.ui-iggrid-table", function (event, ui) { var gridId = '#' + ui.dialogElement[0].id.replace("_updating_dialog_container", ""); //Can try ui.owner.element.context.id var gridColumns = ui.owner.grid.options.columns; for (var i = 0; i < gridColumns.length; i++) { var dataKey = gridColumns[i].key; var comboInput = $(ui.dialogElement).find("td[data-key='" + dataKey + "']").find('input.ui-igcombo-field'); var cellValue = null; //Only get the cell value if editing the row. If adding, then this will return an error if (ui.dialogElement["0"].dataset.isadding === "false") { if (ui.owner._originalValues != null) { cellValue = $(gridId).igGrid("getCellValue", ui.owner._originalValues.Id, dataKey); } } //Verify that the field is a combo box. Probably a better way to do this if (comboInput.length != 0 && comboInput[0].className.indexOf('ui-igcombo-field ui-corner-all') >= 0) { if (cellValue != null) { //Set up a temporary variable for storing the value. //This is also needed for foreign keys because they get set the first time fine, but not the second time for some reason. This forces the value to be set comboInput.igCombo('option', 'gridValue', cellValue); //Add a spinner comboInput.parent().block({ message: '', blockMsgClass: 'blockUI-small' }); //The data has not been bound comboInput.on("igcombodatabound", function (evt, ui) { var actualValue = $(evt.target).igCombo('option', 'gridValue'); if (actualValue != null) { $(evt.target).igCombo('value', actualValue); } //remove the spinner $(evt.target).parent().unblock(); evt.preventDefault(); }); } else { //Initialize the comboboxes when adding a new row. This prevents an issue where the //comboboxes were maintaining old data from a previously edited row if (ui.dialogElement["0"].dataset.isadding === "true") { comboInput.igCombo('option', 'gridValue', null); } } } } });