【发布时间】:2015-04-23 08:52:14
【问题描述】:
我的 Kendo UI Core ListView 出于某种原因无法正常工作,我无法弄清楚原因:
<div id="events-upcoming"></div>
<script type="text/x-kendo-template" id="events-template">
<div class="event">
<p>#: Title #</p>
</div>
</script>
<script>
$(document).ready(function () {
var upcomingEvents = new kendo.data.DataSource({
transport: {
read: {
url: "http://localhost/supersavings/services/eventservice.asmx/GetFutureEventsByCompanyName",
type: "post",
contentType: "application/json; charset=utf-8",
dataType: "json",
data: {
companyName: "admin",
currentDate: "1/1/2015"
}
},
parameterMap: function (options) {
return kendo.stringify(options); // kendo.stringify serializes to JSON string
}
},
schema: {
data: "d"
}
});
$("#events-upcoming").kendoListView({
datasource: upcomingEvents,
template: kendo.template($("#events-template").html())
});
});
</script>
我的 JSON 数据如下:
{
"d":[
{
"__type":"SSEvent",
"EventID":7,
"Title":"Test Title",
"StartDateTime":"/Date(1426212900000)/",
"EndDateTime":"/Date(-62135578800000)/",
"Description":null,
"Link":null,
"UseCurrentLocation":false,
"UseProfileLink":false,
"UserID":0,
"VenueName":"",
"VenueAddress":null,
"VenueCity":null,
"VenueState":null,
"VenueZip":null,
"CompanyDisplayName":null,
"CompanyAddress":null,
"CompanyAddress2":null,
"CompanyCity":null,
"CompanyState":null,
"CompanyZip":null
}
]
}
数据源有效。我已成功手动将其绑定到模板。由于某种原因,ListView 不想工作。
【问题讨论】: