Currently I have an igGrid and the first column has an editorType of "combo" with mode of "dropdown". There are three values in the igCombo: "Approved", "Pending", and "Declined".
It's working fine, however I've been given the requirement of removing the "Pending" item from the combo if the value that comes through in the dataSource is either "Approved" or "Declined". In other words, if the Status value is not equal to "Pending", then "Pending" should not be an option in the list.
I've wrestled with this for awhile and can't figure out how to do it. The two issues I'm running into are:
1) The following jquery code seem to have no effect:
var stat = $('.ui-iggrid-editingcell').text();
if (stat === 'Approved' || stat === 'Declined') {
$('#grid.igCombo option[value="Pending"]').remove();
}
2) Any attempt to fire a method in the dropDownOpening event, or even after the grid has been initialized results in the error "Cannot call methods on igCombo prior to initialization".
Can you please describe how to remove an item from the igCombo inside the igGrid?
Thanks,
Lance
I think the real problem for me is being able to find the appropriate selector for the combo box. If I could do that, then I could just use empty() to clear all three items, and append() to add the two items back that I want ("Approved" and "Declined").
For an igCombo inside an igGrid what is the correct selector needed in order to empty, remove, append items to the combo box?
Hello Lance Gardner,
When using a combo editor inside an igGrid the combo is defined as an editor provider. Therefore you can use the following selector:
ui.editor.igCombo("itemByIndex", id)
in the editCellStarted event, where id is the Index of item within drop-down list. This will return a json object where the "text" key will give you the value you need ("Approved", "Declined"or "Pending").
Please help me to understand if you really need to remove items from the combo. If the data source provide you with the possible options among "Approved", "Declined" and "Pending" you can load them directly to the combo.
Please feel free to let me know if I misunderstood you or if you have any other questions.