I have grid with combo editor for one column.. while grid is bind this way :$('#uoaAuditGrid').igGrid('option', 'dataSourceType', 'json').igGrid('option', 'dataSource', uoaExtendedData).igGrid('dataBind');I also need dynamically provide datasource for the combo which is editor for the column AuditName.
How do I obtain reference so I can do something like this : $(".selector").igCombo("option", "dataSource", ds);
I tried : var editor = $('#uoaAuditGrid')..igGridUpdating("editorForKey", "AuditName"); it did not return anything...
Also where would be related topic in the documentation.
Thanks
$(function () { $('#uoaAuditGrid').igGrid({ columns: [ .................................................. { key: 'AuditName', headerText: 'Audit Name', width: '25%' }, { key: 'AuditId', dataType: 'number', hidden: true }, { key: 'uoa_ba_Id', dataType: 'string', hidden: true } ],
autoGenerateColumns: false, features: [
{ name: 'Updating', enableAddRow: false, editMode: 'cell', columnSettings: [ { columnKey: 'Name', readOnly: true }, { columnKey: 'Description', readOnly: true } , { columnKey: 'uoaBenefitYear', readOnly: true } , { columnKey: 'AuditName', editorType: 'combo', editorOptions: { autoComplete: true, // dataSource: pageController.getAvailAudits(), allowCustomValue: false, textKey: 'AuditName', valueKey: 'AuditName', showDropDownButton: false, enableClearButton: false
} } ........................................................................ });
also why would the following line :
var col = $('#uoaAuditGrid').igGrid("columnsByKey", "AuditName");
would produce an error : jquery-1.9.1.js:507 Uncaught Error: no such method 'columnsByKey' for igGrid widget instance
thnx
Hello mcseidel,
The error is due to misspelled name of the method. The right one is columnByKey. Regarding your first question if you want to access the combo editor and change its dataSource at runtime, you may handle some igGrid Updating event for example editCellStarting or editCellStarted and use the following syntax:
var newComboDs = [{ "ID": 5, "Name": "test" }];
...
editCellStarted: function (evt, ui) { ui.editor.igCombo("option", "dataSource", newComboDs); }
If you have further questions, please let me know.
Regards,Tsanna