Here we went with a custom grid source binder, by ensuring the presence of a schema model in the data source :
Here is the typescript implementation in the case that may help someone :
/**
* This allow setting a source with a model to a grid as it is not supported by kendo
*/
let binder = kendo.data.Binder.extend({
init: function(element, bindings, options) {
kendo.data.Binder.fn.init.call(this, element, bindings, options);
const data = bindings.gridSource.get();
const dataSourceSchema = (element.dataSource.schema || {}) as kendo.data.DataSourceSchema;
const dataSourceModel = dataSourceSchema.model || (dataSourceSchema.model = {});
if (dataSourceModel.fields == undefined) {
dataSourceModel.fields = {};
}
const gridColumns = bindings.gridColumns.get();
const gridColumnsLength = gridColumns.length;
for (let index = 0; index <
gridColumnsLength
; ++index) {
const
gridColumn
=
gridColumns
[index];
const
field
=
gridColumn
.field;
if (field == undefined) {
continue;
}
dataSourceModel.fields[field] = gridColumn.defaultValue == undefined
? field
: {
defaultValue: gridColumn.defaultValue
};
}
const
dataSource
=
new
kendo.data.DataSource({
data: data,
schema: dataSourceSchema
});
element.setDataSource(dataSource);
},
refresh: () => {}
});
kendo.data["binders"].gridSource = binder;
kendo.data["binders"].widget.gridSource = binder;