or
dataSource: {
type:
"aspnetmvc-ajax"
,
transport: {
read: {
url:
"@Url.Action("
_GetEHR
", "
Performance
")"
, type:
"POST"
,
contentType:
"application/json"
,
data:
//searchOptions()
{
periodDate:
function
() {
return
kendo.toString($(
"#periodDate"
).data(
"kendoDatePicker"
).value(),
"MMM yyyy"
) }
}
},
parameterMap:
function
(options) {
return
JSON.stringify(options);
}
},
serverSorting:
true
,
serverFiltering:
true
,
serverPaging:
true
,
pageSize: 50,
schema: {
model: {
fields: {
AccountName: { type:
"string"
},
Month1: { EHR: { type:
"number"
} },
Month2: { EHR: { type:
"number"
} },
Month3: { EHR: { type:
"number"
} },
Month4: { EHR: { type:
"number"
} },
Month5: { EHR: { type:
"number"
} },
Month6: { EHR: { type:
"number"
} },
Month7: { EHR: { type:
"number"
} },
Month8: { EHR: { type:
"number"
} },
Month9: { EHR: { type:
"number"
} },
Month10: { EHR: { type:
"number"
} },
Month11: { EHR: { type:
"number"
} },
Month12: { EHR: { type:
"number"
} }
}
},
data:
function
(data) {
return
data.Data;
},
total:
function
(data) {
return
data.Total;
}
},
},
{
"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;
}
<
div
data-role
=
"view"
data-title
=
"Art de inventario"
data-layout
=
"layout_inventory"
data-init
=
"filterableInventoryList"
data-model
=
"inventoryModel"
>
<
ul
id
=
"inventoryList"
data-role
=
"listview"
>
</
ul
>
</
div
>
<
script
id
=
"inventoryTemplate"
type
=
"text/x-kendo-template"
>
<
div
class
=
"row"
>
<
img
class
=
"pullImage"
src
=
"#=Photo#"
/>#= Name #
<
div
class
=
"metadata"
>
<
span
class
=
"sublink"
>Código : #=Code#</
span
>
</
div
>
</
div
>
</
script
>
function filterableInventoryList(e){
var wid = $(window).width();
var dataSource = new kendo.data.DataSource({
pageSize: 12,
serverPaging: true,
serverFiltering: true,
transport: {
read:{
url: localStorage.getItem("url") + "GetInventoryItems",
dataType: "json",
contentType: "application/json; charset=utf-8"
},
parameterMap: function(options) {
var b = selectMenuModel.get("branch");
var filter = options.filter ? options.filter.filters[0].value : "";
var parameters = {
url: JSON.stringify(localStorage.getItem("url")),
width : wid,
branchId : JSON.stringify(b.Branch_Id),
q: JSON.stringify(filter),
count: options.pageSize,
page: options.page
}
return parameters;
}
},
schema: { // describe the result format
data: "d", // the data which the data source will be bound to is in the "results" field
model : { ...
},
change: function() {
//check whether any data is returned
if (!this.view()[0]) {
//disable endless scroll
$("#inventoryList").data("kendoMobileListView").stopEndlessScrolling();
}
}
});
$("#inventoryList").kendoMobileListView({
dataSource: dataSource,
template: $("#inventoryTemplate").text(),
filterable: {
filterable: true,
placeholder: "Buscar Item..."
},
endlessScroll: true,
scrollTreshold: 30 //treshold in pixels
});
}