function populateColumn(widget, value) {
widget.setDataSource({
data: ['Category A', 'Category B', 'Category C']
});
//set value if one was select
widget.value(value);
}
fd.control('Control1').$on('edit', function(e) {
if (e.column.field === 'Column1') {
//pass widget + current column value
populateColumn(e.widget, e.model.Column1);
}
})
This code works great when in desktop mode. However, on mobile, it fails when editing a record in the popup editor.
The problem is that the object 'e' passed in the 'onEdit' action in the popup editor does not contain either the 'column' or 'widget' properties. There is a 'model' property holding the data, and a 'container' property that seems like a complicated kendoUI thing. I have tried spelunking in this, but have not been able to work out a solution on my own.
Is there a way to target the widget and set options for a particular field when in the popup editor? Or can you suggest another way to accomplish this?
Even if configuring the grid 'editable' property to 'incell' instead of 'popup', this code still doesn't work on mobile. Editing occurs within the table rather than the popup, but the object passed to the 'edit' event is still missing the 'column' and 'widget' properties.
Disabling popup editing is undesirable on a mobile browser, so this would not be the best solution in any case, but I thought I'd mention that I investigated this option.
Edit: Solved, I figured this out right after posting.
From the documentation for the Dropdown field, it appears that this contol is based on the Kendo UI ComboBox when the 'allow user value' option is set. So the following modification works fine:
Hi. Circling back on this because it appears this code is no longer working in popup mode for Datatable dropdown columns when the 'Allow user value' property is true. If this option is set, the following code returns a null value: