I've the following problem. The following code works in JS:
Application1.Trackers = function (params) {
var viewModel = {
dsTrackers: new DevExpress.data.DataSource({
store: Application1.db,
searchExpr: "Bezeichnung"
}),
searchString: ko.observable(''),
find: function () {
viewModel.showSearch(!viewModel.showSearch());
viewModel.searchString('');
},
showSearch: ko.observable(false),
};
ko.computed(function () {
return viewModel.searchString();
}).extend({
throttle: 500
}).subscribe(function (value) {
viewModel.dsTrackers.filter("Bezeichnung", "contains", value);
viewModel.dsTrackers.pageIndex(0);
viewModel.dsTrackers.load();
});
return viewModel;
};
In Typescript I tried it this way, but this doesn't work:
module MyExtremeApp {
export function Trackers(params: { id: any }) {
return {
dsTrackers: new DevExpress.data.DataSource({
store: MyGlobals.oTrackerManager.getTrackerCustomStore(),
searchExpr: "Bezeichnung"
}),
searchString: ko.observable(''),
find: function () {
this.showSearch(!this.showSearch());
this.searchString('');
},
showSearch: ko.observable(false),
};
ko.computed(() => {
return this.searchString();
}).extend({
throttle: 500
}).subscribe(function (value) {
this.dsTrackers.filter("Bezeichnung", "contains", value);
this.dsTrackers.pageIndex(0);
this.dsTrackers.load();
});
}
}
It never jumps into ko.computed(). Does anyone has an idea why not? I'm new to typescript
Thank you very much. Best Regards