Overview
I am using dojo and dgrid to build a grid. The 2 relevant columns are Client and Proposal. Double clicking on either column will allow you to edit it with a dijit/form/Select. I want options for proposal to be be based on the options for client.
Here is the column plugin used for both colums:
define([
"dojo",
"sb",
"put-selector/put",
"dgrid/editor",
"dijit/form/Select"
], function(dojo, sb, put, editor, Select){
dojo.global.starbug.grid.columns = dojo.global.starbug.grid.columns || {};
dojo.global.starbug.grid.columns.select = function(column){
//populate the cell with the label or value
column.renderCell = function(object, value, cell, options, header){
put(parent && parent.contents ? parent : cell, ".dgrid-select");
items = column.editorInstance.getOptions();
var label;
for (var i in items) {
if (value == items[i].value) value = items[i].label;
}
put(cell, 'span.'+value.replace(/ /g, '-').toLowerCase(), value);
};
column.editorArgs = {
style:'width:100%',
labelAttr:'label',
store:sb.get(column.from, 'select')
};
column = editor(column, Select, "dblclick");
return column;
};
});
The store is equivalent to dojo/store/JsonRest.
The Problem
If I understand the nature of dgrid and dojo/store, I need to find a way populate/update the dijit/form/Select options when the user attempts to edit the column.
In summary
- How do I determine when the user attempts to edit the column?
- How do I then access the dijit/form/Select so that I can update it?
- How can I delay displaying the editor until it is populated?