Skip to content

Replies

0
Michael Seidel
Michael Seidel answered on Oct 25, 2016 1:58 PM

Maya, you are THE BEST.. thank you.

0
Michael Seidel
Michael Seidel answered on Oct 24, 2016 3:31 PM

Maya, thanks for your comprehensive answer.. I actually implemented destroy option before and it works fine .. but change data source option has some issues, despite  similarity to your sample :

function bindMatchGrid() {

if (pageController && $.isFunction(pageController.uoa)) {
var uoaData = pageController.uoa(false);
var uoaExtendedData = transformMatchData(uoaData);
//$('#uoaAuditGrid').igGrid("destroy");
//initUoaAuditGrid();
$('#uoaAuditGrid').igGrid('option', 'dataSourceType', 'json').igGrid('option', 'dataSource', uoaExtendedData) // .igGrid('dataBind');
if ($('#uoaAuditGrid').igGridUpdating("editorForKey", "AuditName") === null || $("#uoaAuditGrid").igGridUpdating("editorForKey", "AuditName")[0].tagName !== "SPAN") {
// editors are not initialized yet. Entering edit mode will initialize the editors.
$("#uoaAuditGrid").igGridUpdating("startEdit", 0, 0);
$("#uoaAuditGrid").igGridUpdating("endEdit");
}
var editor = $('#uoaAuditGrid').igGridUpdating("editorForKey", "AuditName");
editor.igCombo("option", "dataSource", pageController.getAvailAudits());
//var columnSettings = $('#uoaAuditGrid').igGridUpdating("option", "columnSettings");
//$.each(columnSettings, function () {
// if (this.columnKey === "AuditName") {
// this.editorOptions.dataSource = $.grep(pageController.getAvailAudits(), function (a) {
// return (a.completed == 1)
// });
// }
//})
}
}

on the first run after page load .. even after those two lines got executed : 

$("#uoaAuditGrid").igGridUpdating("startEdit", 0, 0);
$("#uoaAuditGrid").igGridUpdating("endEdit");

the  $("#uoaAuditGrid").igGridUpdating("editorForKey", "AuditName")[0].tagName  is returning 'TABLE' and editor.igCombo("option", "dataSource", pageController.getAvailAudits()); cause : 

jquery-1.9.1.js:507 Uncaught Error: cannot call methods on igCombo prior to initialization; attempted to call method 'option'…

if I would close the form and reopen it again that would do the same… but if I would try to open drop down , although it will be empty because of the error.. but than next close open cycle it will work ( $("#uoaAuditGrid").igGridUpdating("editorForKey", "AuditName")[0].tagName will return 'SPAN', data source get assigned.. and drop down has all correct items ) May be you have some thoughts why it might happened.. seems like sequence that I have exactly as in your sample.. main grid get data source.. than editor is getting it.. 

Also what would be a method to find out if grid were destroyed and needed to be initialized again..