This question is locked. New answers and comments are not allowed.
Hi,
Question 1
I'm having some difficulty in applying a filter on an hierarchical data source. It seems to have to do with the difference between getByID and getByFilter as indicated in the following documentation: http://docs.telerik.com/platform/backend-services/javascript/data/relations/relations-defining.
My code:
01.
var
expandExpr = {
02.
"Accounts"
: {
03.
"TargetTypeName"
:
"Account"
,
04.
"ReturnAs"
:
"Accounts"
,
05.
// "Filter": { field: "MainAccount", operator: "eq", value: true },
06.
// "Filter": { "MainAccount": { "eq": true } }
07.
}
08.
};
09.
10.
11.
var
overviewDataSource =
new
kendo.data.HierarchicalDataSource({
12.
type:
'everlive'
,
13.
transport: {
14.
// Required by Backend Services
15.
typeName:
'User'
,
16.
read: {
17.
contentType:
"application/json"
,
18.
headers: {
19.
"X-Everlive-Expand"
: JSON.stringify(expandExpr)
20.
}
21.
}
22.
},
23.
24.
25.
schema: {
26.
model: userModel,
27.
hasChildren:
function
(item) {
28.
return
item.?Accounts && item.Accounts.length > 0;
29.
},
30.
children:
"Accounts"
31.
},
32.
33.
change:
function
(e) {
34.
35.
if
(e.items && e.items.length > 0) {
36.
$(
'#no-overview-span'
).hide();
37.
}
else
{
38.
$(
'#no-overview-span'
).show();
39.
}
40.
},
41.
serverFiltering:
true
,
42.
filter: { field:
"Name"
, operator:
"eq"
, value:
"Savings"
},
43.
sort: { field:
'Name'
, dir:
'asc'
}
44.
});
If either of the filters within expandExpr (lines 5 and 6) is uncommented error 618 is returned by the request.
Can this be overcome, please indicate how?
Question 2
I the sample above there are ?Users with multiple Accounts linked to each User. ?And an Account have multiple Transactions. How will I be able expand and filter the Transactions linked to the Account.
Please assist.
Thanks,
Johann