Listview Indexing Problem

3 posts, 2 answers
  1. Matt Miller
    Matt Miller avatar
    23 posts
    Member since:
    Jan 2012

    Posted 23 Nov 2013 Link to this post

    ListView Definition

     var carriers = $("#carrierList").kendoListView({
                dataSource: t94StragglerCarriers,
                selectable: true,
                pageable : true ,
                change: onChange,
                dataBound: onDataBound,
                dataBinding : onDataBinding ,
                template : kendo.template($("#carrierTemplate").html())

    Template Definition

    <script type="text/x-kendo-tmpl" id="carrierTemplate">
        <div id='carrierListVal' class='k-textbox'>#:val#</div>    

    DataSource Definition

     var t94StragglerCarriers = new{
                transport: {
                    read: {
                        url: "/MenuTrain/T94StragglerCarriers",                    
                        dataType: "json"                   
                    schema: {
                        model: {
                            id: "id",                        
                            fields: {
                                id: {type : "string"} ,
                                val: {type : "string"}
                    pageSize: 5,
                    serverPaging : true 

    I've tried several variations for the datasource. From not specifying the schema to just specifying the id.

    OnChange Event Handler Definition

    function onChange() {
                var listView = $("#carrierList").data("kendoListView");
                var index =;
                var item = listView.dataSource.view()[index];
                console.log("Item " + index + " selected. Text = " +;

    Here is the json string returned from my controller's action method: 

    [{"id":"10eac72a-d62d-434f-8505-4869cdb27b04","val":"CHTT"},{"id":"10eac72a-d62d-434f-8505-4869cdb27b04","val":"CMO "},{"id":"10eac72a-d62d-434f-8505-4869cdb27b04","val":"CTCX"},{"id":"10eac72a-d62d-434f-8505-4869cdb27b04","val":"DBUX"},{"id":"10eac72a-d62d-434f-8505-4869cdb27b04","val":"GATX"},{"id":"10eac72a-d62d-434f-8505-4869cdb27b04","val":"MWCX"},{"id":"10eac72a-d62d-434f-8505-4869cdb27b04","val":"NDYX"},{"id":"10eac72a-d62d-434f-8505-4869cdb27b04","val":"PLMX"},{"id":"10eac72a-d62d-434f-8505-4869cdb27b04","val":"TAEX"},{"id":"10eac72a-d62d-434f-8505-4869cdb27b04","val":"TCIX"},{"id":"10eac72a-d62d-434f-8505-4869cdb27b04","val":"TEIX"},{"id":"10eac72a-d62d-434f-8505-4869cdb27b04","val":"TILX"},{"id":"10eac72a-d62d-434f-8505-4869cdb27b04","val":"UP  "},{"id":"ffbcdb6c-4d3a-45f6-8ef6-ada5f28ba44b","val":"MDXx"}]

    The listview renders correctly. But it's as if the listview's select().index() methods are treating each field as an item. For example , the first object's id field is index 0, the first object's val field is index 1, and so on.

    What am i doing wrong here?

  2. Answer
    Alexander Valchev
    Alexander Valchev avatar
    2895 posts

    Posted 26 Nov 2013 Link to this post

    Hi Matt,

    I posted a reply on this issue in the other thread which you opened:

    Alexander Valchev
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Answer
    Matt Miller
    Matt Miller avatar
    23 posts
    Member since:
    Jan 2012

    Posted 26 Nov 2013 Link to this post

    Thanks for your help and patience. Eventually i will figure this stuff out.
Back to Top