I have a grid with a igCombo used to pick values for one of the columns. When I add or delete rows in the grid I need to refresh / rebind the combo to show the correct list. Is it possible to do this?
I have tried setting the datasource of the combo in the grid but the dropdown list does not change.
After updating the dataSource variable for the grid's combo I tried this:
var editor = $("#tbGridUserRoles").igGridUpdating("editorForKey", "FieldServiceCentreID");
$(editor).igCombo("selectedIndex", -1);
$(editor).igCombo("activeIndex", -1);
$(editor).igCombo("dataBind");
Doesn't work.
Have also tried this:
function refreshComboDataSource(columnKey, newDataSource) { var colSettings = $("#tbGridUserRoles").igGridUpdating("option", "columnSettings"); for (var i = 0; i < colSettings.length; i++) { if (colSettings[i].columnKey === columnKey) { if (colSettings[i].editorType && colSettings[i].editorType === "combo") { colSettings[i].editorOptions.dataSource = newDataSource; } $("#tbGridUserRoles").igGridUpdating("option", "columnSettings", colSettings); break; } } }
Doesn't work.Neither of these generate errors - they just dont change the contents of the combo when its clicked.
Any help appreciated.
Hello Ecatenate,
Thank you for posting in the community.
Accessing the editor through the Updating feature of the grid should work ok, however I would also suggest reassiging the editor's (updated) datasource and then rebinding.
Attached is a small sample illustrating this scenario.
Please let me know if this helps.
Thanks for responding Petar, however your sample does not demonstrate this.
The sample simply shows a grid binding to a datasource. Did you send me the wrong sample?
Regards, Simon