i'm trying to bind a grid with hireachical data from server
i read the by entityframework and the output on the client is the follow:
there is a child collection (named "FollowUp" and has got an only one row) in this json output
the field "FollowUp" contains several properties: FollowUp":{"Fk_ID_ressol":11,"FollowUp1":"\/Date(1367877600000+0200)\/","FollowUp2":null,"FollowUp3":null,"Id":4,"Note":null}
in my javascript i've tried to do the following:
give exception here because the parameter "data.FollowUp.FollowUp1" doesn't exist because data.FollowUp is null
(code generated by visuatudio debugger from kendo.web.min.js)
it looks like that this datasource doesn't expose the property "FollowUp" at all!
could you help me to understand, please!
Alessio.
i read the by entityframework and the output on the client is the follow:
{
"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"
}]}
there is a child collection (named "FollowUp" and has got an only one row) in this json output
the field "FollowUp" contains several properties: FollowUp":{"Fk_ID_ressol":11,"FollowUp1":"\/Date(1367877600000+0200)\/","FollowUp2":null,"FollowUp3":null,"Id":4,"Note":null}
in my javascript i've tried to do the following:
---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"
}]
});
give exception here because the parameter "data.FollowUp.FollowUp1" doesn't exist because data.FollowUp is null
(code generated by visuatudio debugger from kendo.web.min.js)
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;
}
it looks like that this datasource doesn't expose the property "FollowUp" at all!
could you help me to understand, please!
Alessio.