or
EntityResource.query(
function
(entities)
{
//Entities are loaded dynamically when project selected.
//form data and append to tree
treeview.append(..., projectNode);
}
EntityResource.query(
function
(entities)
{
var
localDataSource =
new
kendo.data.HierarchicalDataSource({ data: entities});
localDataSource .fetch();
treeview.append(localDataSource ,projectNode);
}
var
hierarchialEntities = [ {
EntityName:
"Parent1"
,
items: [
{ EntityName:
"Entity1"
, class:
'.entity-node'
, isEntity:
true
},
{ EntityName:
"Entity2"
, class:
'.entity-node'
, isEntity:
true
},
{ EntityName:
"Entity3"
, class:
'.entity-node'
, isEntity:
true
,
items: [{ EntityName:
"Entity7"
, class:
'.entity-node'
, isEntity:
true
}]
}
]
}, {
EntityName:
"Parent2"
,
items: [
{ EntityName:
"Entity4"
, class:
'.entity-node'
, isEntity:
true
},
{ EntityName:
"Entity5"
, class:
'.entity-node'
, isEntity:
true
},
{ EntityName:
"Entity6"
, class:
'.entity-node'
, isEntity:
true
}
]
}
];
treeview.append(hierarchialEntities,projectNode); //works as expected!!!
{
"GetDocumentsResult"
:[{
"AnnoEsercizio"
:2013,
"BatchID"
:636614,
"CustomerDocumentTypeID"
:401,
"Data"
:
"\/Date(1366236000000+0200)\/"
,
"FileExtension"
:
".jpg"
,
"FollowUp"
:{
"Fk_ID_ressol"
:11,
"FollowUp1"
:
"\/Date(1367877600000+0200)\/"
,
"FollowUp2"
:
null
,
"FollowUp3"
:
null
,
"Id"
:4,
"Note"
:
null
},
"Frequenza"
:
"MENSILE"
,
"Id"
:4,
"Nota"
:
null
,
"ObjectID"
:
"1"
,
"PathBuildingRuleID"
:9,
"Piva"
:
"xdfdff"
,
"RagioneSociale"
:
"Kellner"
,
"RepositoryRegistrationDate"
:
"\/Date(1358463600000+0100)\/"
,
"Stato"
:
"OK"
},{
"AnnoEsercizio"
:2013,
"BatchID"
:636614,
"CustomerDocumentTypeID"
:401,
"Data"
:
"\/Date(1361142000000+0100)\/"
,
"FileExtension"
:
".jpg"
,
"FollowUp"
:
null
,
"Frequenza"
:
"MENSILE"
,
"Id"
:5,
"Nota"
:
null
,
"ObjectID"
:
"2"
,
"PathBuildingRuleID"
:9,
"Piva"
:
"xdfdff"
,
"RagioneSociale"
:
"Kellner"
,
"RepositoryRegistrationDate"
:
"\/Date(1366236000000+0200)\/"
,
"Stato"
:
"OK"
},{
"AnnoEsercizio"
:2013,
"BatchID"
:636614,
"CustomerDocumentTypeID"
:401,
"Data"
:
"\/Date(1363561200000+0100)\/"
,
"FileExtension"
:
".jpg"
,
"FollowUp"
:
null
,
"Frequenza"
:
"MENSILE"
,
"Id"
:6,
"Nota"
:
null
,
"ObjectID"
:
"3"
,
"PathBuildingRuleID"
:9,
"Piva"
:
"xdfdff"
,
"RagioneSociale"
:
"Kellner"
,
"RepositoryRegistrationDate"
:
"\/Date(1366236000000+0200)\/"
,
"Stato"
:
"OK"
},{
"AnnoEsercizio"
:2013,
"BatchID"
:636614,
"CustomerDocumentTypeID"
:401,
"Data"
:
"\/Date(1366236000000+0200)\/"
,
"FileExtension"
:
".jpg"
,
"FollowUp"
:
null
,
"Frequenza"
:
"MENSILE"
,
"Id"
:7,
"Nota"
:
null
,
"ObjectID"
:
"4"
,
"PathBuildingRuleID"
:9,
"Piva"
:
"xdfdff"
,
"RagioneSociale"
:
"Kellner"
,
"RepositoryRegistrationDate"
:
"\/Date(1366236000000+0200)\/"
,
"Stato"
:
"DA VERIFICARE"
},{
"AnnoEsercizio"
:2013,
"BatchID"
:636614,
"CustomerDocumentTypeID"
:401,
"Data"
:
"\/Date(1357081200000+0100)\/"
,
"FileExtension"
:
".jpg"
,
"FollowUp"
:
null
,
"Frequenza"
:
"TRIMESTRALE"
,
"Id"
:11,
"Nota"
:
null
,
"ObjectID"
:
"6"
,
"PathBuildingRuleID"
:9,
"Piva"
:
"12345678901"
,
"RagioneSociale"
:
"Alessio"
,
"RepositoryRegistrationDate"
:
"\/Date(1366236000000+0200)\/"
,
"Stato"
:
"OK"
}]}
---hirearchicaldatasource-----
Master._resSolDataSource =
new
kendo.data.HierarchicalDataSource({
transport: {
read: {
beforeSend:
function
(xhr, s) {
s.data = JSON.stringify(Master._filter);
},
type:
"POST"
,
url: _rootUrl +
'wcf/ResponsabilitaSolidaleService.svc/getdocuments'
,
contentType:
"application/json; charset=utf-8"
,
dataType:
"json"
}
},
schema: {
data:
"GetDocumentsResult"
,
model: {
id:
"Id"
,
fields: {
Id: { type:
"number"
},
Piva: { type:
"string"
},
RagioneSociale: { type:
"string"
},
Data: { type:
"date"
},
AnnoEsercizio: { type:
"number"
},
Frequenza: { type:
"string"
},
Stato: { type:
"string"
}
},
children:
"FollowUp"
}
},
group: { field:
"RagioneSociale"
, dir:
"asc"
}
});
------and
in
the grid-----
$(
"#adminGrid"
).kendoGrid({
........,
...other code....,
.....,
columns: [{
field:
"Id"
,
hidden:
true
}, {
field:
"Piva"
,
title:
"Partiva IVA"
}, {
field:
"RagioneSociale"
,
title:
"Ragione Sociale"
}, {
field:
"Data"
,
format:
"{0:dd/MM/yyyy}"
}, {
field:
"AnnoEsercizio"
,
title:
"Anno esercizio"
}, {
field:
"Frequenza"
}, {
field:
"Stato"
}, {
command: [
{
name:
"download"
,
click: Master.download
},
{
name:
"followup"
,
click: Master.followup
}
],
title:
" "
}, {
field:
"FollowUp[0].FollowUp1"
,
//<--FollowUp seems to be null
title:
"fu1 child"
}]
});
function
anonymous(data) {
var
o,e=kendo.htmlEncode;
with
(data){o=
'<tr data-uid="'
+(data.uid)+
'" role=\'row\'><td class="k-group-cell"> </td><td style="display:none" role=\'gridcell\'>'
+e(data.Id==
null
?
''
:data.Id)+
'</td><td role=\'gridcell\'>'
+e(data.Piva==
null
?
''
:data.Piva)+
'</td><td role=\'gridcell\'>'
+e(data.RagioneSociale==
null
?
''
:data.RagioneSociale)+
'</td><td role=\'gridcell\'>'
+e(kendo.format(
"{0:dd/MM/yyyy}"
,data.Data==
null
?
''
:data.Data))+
'</td><td role=\'gridcell\'>'
+e(data.AnnoEsercizio==
null
?
''
:data.AnnoEsercizio)+
'</td><td role=\'gridcell\'>'
+e(data.Frequenza==
null
?
''
:data.Frequenza)+
'</td><td role=\'gridcell\'>'
+e(data.Stato==
null
?
''
:data.Stato)+
'</td><td role=\'gridcell\'><a class="k-button k-button-icontext k-grid-download" href="#"><span class=" "></span>download</a><a class="k-button k-button-icontext k-grid-followup" href="#"><span class=" "></span>followup</a></td><td role=\'gridcell\'>'
+e(data.FollowUp.FollowUp1==
null
?
''
:data.FollowUp.FollowUp1)+
'</td></tr>'
;}
return
o;
}