When I use the normal combo in the grid all the work, when the same use multicolumn with template does not display the correct value selected row … Displayed as [Object object], how can I fix it?
My Combo JSON:
{
“template”: {
“input”: “#code# #name#”,
“columns”: [
{“header”: “Code”, “width”: 70, “option”: “#code#”},
{“header”: “Name”, “width”: 600, “option”: “#name#”}
]
},
“options”: [
<% @business_types.each do |es| %>
{“value”: “<%= es.id %>”, “text”: { “code”: “<%= es.code %>”, “name”: “<%= es.name %>” }},
<% end %>
]
}
My Grid XML:
<?xml version="1.0" encoding="UTF-8"?> Business Type<% @organization_business_types.each_with_index do |bt, i| %>
<%= bt.business_type_id %>
<% end %>
Where a error? How to fix?
I apologize for the delay with your request.
Unfortunately it’s not available to use the multicolumn combo in the “combo” exCell
Oh no. I’ve same issue now. In my grid there are multicolumn combos only and everything work great except this one issue. I didn’t see any restrictions in documentation.
Is there are no chance to prototype the eXcell type to make it working?
I even tried such ugly approach which didn’t work as well
// Removing existing combo from grid
combo_in_gird.unload();
combo_in_grid = null;
// Changing eXcell type to something different (just experimenting)
grid.setColumnExcellType(cell_index, "ed");
grid.cells(row_id, cell_index).setValue("future_combo_value");
grid.setColumnExcellType(cell_index, "combo");
// Initialising combo again (does not work)
combo_in_gird = grid.getColumnCombo(cell_index);
combo_in_grid.load("same_data_source");
Initialy, when you create such multicolumn combo you’re able to set some default value. It would be really cool if you (or some experienced user) could find any elegant solution for this issue. Multicolumn combos are just very cool and useful.
Thanks,
Lev
OK, for anybody who has similar problem I could solve this little issue. This solution works for me. I don’t know if this approach has side effects (we’ll see). So, be careful if you like to use it.
Add somewhere (after dhtmlx.js)
dhtmlXGridCellObject.prototype.extSetMultiColValue = function (value) {
this.setValue(value);
this.cell.innerHTML = this.cell.combo_value;
};
Then instead of using:
[color=darkred]grid.cells(row_id, cell_index).setValue("xyz)
use:
[color=darkgreen]grid.cells(row_id, cell_index).extSetMultiColValue("xyz)