0
votes

My Kendo UI Core ListView is not working for some reason and I can't figure out why:

<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>

My JSON Data is as follows:

{
   "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
      }
   ]
}

The DataSource works. I've successfully manually bound it to a template. For some reason the ListView does not want to work.

1

1 Answers

1
votes

It was a dumb mistake. In the ListView datasource should be DataSource. Only problem was a lowercase S. I wish there was a debugger or tool that could catch those kind of casing or misspelling errors like Visual Studio does with C#.