Hi.
Suppose I have following hierarchy
project1:
-- entity1
-- entity2
-- entity3
project2:
-- entity1
-- entity2
-- entity3
...
Project and "entities" are basically different and I use different url to get them, say /serv/prj for project and /serv/entities for entities.
When page is loaded there are only projects. When I expand project items should be loaded (refreshed) from server. Items for selected project
should be refreshed each time I expand the project.
Now it working ok in a static manner, I have following:
and have
dataTextField: ['Namespace', 'EntityName'] for tv.
But it is static. It loads everything one time and if I need to refresh data I have to reload page...
Is it possible to accomplish for within a single HierarchicalDataSource? As I mentioned project and entities are different, and to get
them I use two different urls, because in documentation it is stated for homogeneous data that it supply parent node id for request.
In my case data are heterogeneous.
What I'm currently unsuccessfully tried to do is to load separately projects, and on expansion refrehs items:
But on tv.append I get following exception:
Uncaught TypeError: Property 'children' of object [object Object] is not a function.
So please help with any approach.
Thanks in advance.
Suppose I have following hierarchy
project1:
-- entity1
-- entity2
-- entity3
project2:
-- entity1
-- entity2
-- entity3
...
Project and "entities" are basically different and I use different url to get them, say /serv/prj for project and /serv/entities for entities.
When page is loaded there are only projects. When I expand project items should be loaded (refreshed) from server. Items for selected project
should be refreshed each time I expand the project.
Now it working ok in a static manner, I have following:
var
nodeZ = kendo.data.Node.define({
hasChildren:
"Entities"
,
id:
"EntityNamespaceID"
,
children:
"Entities"
});
var
dataSource =
new
kendo.data.HierarchicalDataSource(
{
transport: {
read: {
url:
"ns"
,
dataType:
"json"
}
},
schema: { model: nodeZ},
filter: {
logic:
"or"
,
filters: [
{ field:
"EntityName"
, operator:
"neq"
, value:
"null"
},
{ field:
"Namespace"
, operator:
"neq"
, value:
"null"
}
]
}
});
and have
dataTextField: ['Namespace', 'EntityName'] for tv.
But it is static. It loads everything one time and if I need to refresh data I have to reload page...
Is it possible to accomplish for within a single HierarchicalDataSource? As I mentioned project and entities are different, and to get
them I use two different urls, because in documentation it is stated for homogeneous data that it supply parent node id for request.
In my case data are heterogeneous.
What I'm currently unsuccessfully tried to do is to load separately projects, and on expansion refrehs items:
expand:
function
(e)
{
var entityNodeZ = kendo.data.Node.define({
hasChildren: "Children",
id: "EntityId",
children: "Children"
});
var
nodeData =
this
.dataItem(e.node); //project node
var
entityDataSource =
new
kendo.data.HierarchicalDataSource(
{
transport: {
read: {
url:
"entity"
,
dataType:
"json"
},
parameterMap:
function
()
{
return
{ ns: nodeData.PrjId};
}
},
schema: { model: entityNodeZ},
filter: { field:
"EntityName"
, operator:
"neq"
, value:
"null"
}
});
entityDataSource.fetch();
var
tv= $(
'#userprjtreeview'
).data(
'kendoTreeView'
);
tv.append(entityDataSource.view().slice(0), nodeData);
}
But on tv.append I get following exception:
Uncaught TypeError: Property 'children' of object [object Object] is not a function.
So please help with any approach.
Thanks in advance.