I have a calculated property named "hasDashboards" that I am binding to with the enabled or visible bindings.
var ViewModel = kendo.data.ObservableObject.extend({
init: function() {
kendo.data.ObservableObject.fn.init.call(this);
}
});
var MyViewModel = ViewModel.extend({
init: function() {
ViewModel.fn.init.call(this);
},
dashboards: new kendo.data.DataSource({ data: [] }),
hasDashboards: function() {
var ds = this.get("dashboards");
return ds.data().length;
}
});
I have tried doing this with an observable array as well instead of a data source, but neither hook into the binding updates. I can get this to work if I use the trigger() function on the view model and specify the hasDashboards field as a parameter, but I would like to avoid this additional complexity. I know I am doing something unsupported by deriving from ObservableObject directly, but we need availability and also build custom widgets.
I have also tried the observable array doing this.get("dashboards.length") (which is supported according to the docs), but that didn't work either. Let me know, thanks!