Hi,
Is it possible to access in child url function, the parent fields (I want the type to make a condition for the url) ?
Thank you in advance.
Here a part of the source code
let matieresSource: kendo.data.HierarchicalDataSourceOptions = {
transport: {
read: {
url: (params) => {
this
.$log.info(
"params"
, params);
return
this
.apiEndpoint +
"/v1/parcours/"
+ params.id +
"/matieres/edito/tree"
;
},
type:
"GET"
,
dataType:
"json"
,
beforeSend:
function
(req) {
let authData = localStorage.getItem(
'authData'
);
let auth =
"Bearer "
+ JSON.parse(authData).access_token;
req.setRequestHeader(
'Authorization'
, auth);
}
},
parameterMap: (data: kendo.data.DataSourceTransportParameterMapData, type: string) => {
// Remove query string in the URL
data =
null
;
return
data;
}
},
schema: {
model: {
fields: {
id:
"id"
,
name:
"name"
,
type:
"type"
,
baseElement:
"baseElement"
,
isDirty:
"isDirty"
,
hasDirty:
"hasDirty"
,
nbChildren:
"nbChildren"
},
hasChildren: (data: any) => {
return
data.nbChildren > 0 ?
true
:
false
;
},
children: modulesSource
}
}
};
let parcoursSource: kendo.data.HierarchicalDataSourceOptions = {
transport: {
read: {
url: (params) => {
return
this
.apiEndpoint +
"/v1/parcours/edito/tree"
;
},
type:
"GET"
,
dataType:
"json"
,
beforeSend:
function
(req) {
let authData = localStorage.getItem(
'authData'
);
let auth =
"Bearer "
+ JSON.parse(authData).access_token;
req.setRequestHeader(
'Authorization'
, auth);
}
},
parameterMap: (data: kendo.data.DataSourceTransportParameterMapData, type: string) => {
return
data;
}
},
schema: {
model: {
fields: {
id:
"id"
,
idLms:
"idLms"
,
name:
"name"
,
type:
"type"
,
baseElement:
"baseElement"
,
isDirty:
"isDirty"
,
nbChildren:
"nbChildren"
},
hasChildren: (data: any) => {
return
data.nbChildren > 0 ?
true
:
false
;
},
children: matieresSource
}
}
};