Hello,
I'm totally newbie in TypeScript and in KendoUI :) So I do not know how to explode my problem in the best way. There may be a better approach.
Here, I have a grid with several columns, including two "Result" and "ResultReason" that I would like to make dependent. That is, when a value is selected in the first, the second is automatically (if possible) filtered. My two grids are in two different GridColumn objects.
The ideal would be to filter the columns automatically (cascadeFrom), but is this possible?
If not, how do I read the selected value in the first column, in the second class? Should I call a function on the hand?
-----------Parent grid column-----------------------
export const ResultColumn: kendo.ui.GridColumn = {
field:
"ResultId"
,
title:
"Result"
,
width: 120,
editor: (container, options) => {
debugger;
$(
"<input id=\"ResultColumn\" data-text-field=\"ResultName\" data-value-field=\"ResultName\" data-value-field=\"ResultId\" data-bind=\"value:"
+ options.field +
"\"/>"
)
.appendTo(container).kendoComboBox({
dataSource:
new
kendo.data.DataSource({
serverPaging:
false
,
transport: {
read: {
url: `${WCFBaseUrl}CustomActivities/ResultsList`,
dataType:
"jsonp"
,
type:
"webapi"
}
},
schema: {
data:
"Data"
,
total:
"Total"
,
errors:
"Errors"
,
}
}),
dataValueField:
"ResultId"
,
dataTextField:
"ResultName"
,
valuePrimitive:
true
}).data(
"kendoComboBox"
);
},
};
-----------------Child grid column----------------------
import { ResultColumn } from
"./result-column"
;
export const ResultReasonColumn: kendo.ui.GridColumn = {
field:
"ResultReasonId"
,
title:
"Result Reason"
,
width: 120,
editor: (container, options) => {
debugger;
$(
"<input id=\"ResultReasonColumn\" data-text-field=\"ResultReasonName\" data-value-field=\"ResultReasonName\" data-value-field=\"ResultReasonId\" data-bind=\"value:"
+ options.field +
"\"/>"
)
.appendTo(container).kendoComboBox({
cascadeFrom:
"ResultColumn"
,
//doesn't work
dataSource:
new
kendo.data.DataSource({
serverFiltering:
true
,
//doesn't work
serverPaging:
false
,
transport: {
read: {
url: `${WCFBaseUrl}CustomActivities/ResultReasonsList`,
dataType:
"jsonp"
,
type:
"webapi"
}
},
schema: {
data:
"Data"
,
total:
"Total"
,
errors:
"Errors"
,
}
}),
dataValueField:
"ResultReasonId"
,
dataTextField:
"ResultReasonName"
,
valuePrimitive:
true
}).data(
"kendoComboBox"
);
}
}
Thank you