【问题标题】:Kendo ListView not working剑道列表视图不起作用
【发布时间】: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 不想工作。

【问题讨论】:

    标签: listview kendo-ui


    【解决方案1】:

    这是一个愚蠢的错误。 ListView 中的数据源应该是DataSource。唯一的问题是小写的 S。我希望有一个调试器或工具可以像 Visual Studio 使用 C# 那样捕获那些大小写错误或拼写错误。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多