2013-10-11 84 views
1

我正在开发一个使用Kendo ui mobile和Phonegap的移动应用程序。我有一个JSON数据,Here。我想将这个JSON绑定到kendo ui移动列表视图。我试过下面的代码,但它不工作。它甚至没有显示列表视图。谁能帮帮我吗?谢谢。json在kendo ui移动列表视图中的数据绑定

function mobileListViewEndlessScrolling() { 


     var dataSource = new kendo.data.DataSource({ 
       serverFiltering: true, 
       transport  : { 
        read: { 
         type  : "GET", 
         url  : "http://www.json-generator.com/j/bZnjoTdIuq?indent=4", 
         contentType: "application/json; charset=utf-8", 
         dataType : "json", 
         error  : function (xhr, ajaxOptions, thrownError) { 
          alert("error " + xhr.responseText); 
         } 
        } 
       }, 
       schema   : { 
        data: "Data" 
       }, 
       type   : "json", 
       parameterMap : function (options) { 
        return JSON.stringify(options); 
       } 
      }); 




      $("#endless-scrolling").kendoMobileListView({ 
       dataSource: dataSource, 
       template: $("#endless-scrolling-template").text(), 
       endlessScroll: true 
      }); 
     } 

,这里是我的列表视图项模板,

<script type="text/x-kendo-tmpl" id="endless-scrolling-template"> 



<div class="product"> 

    <img src="images/image.jpg" alt="#=ProductName# image" class="pullImage"/> 
    <h3>#:ProductName#</h3> 
    <p>$#:kendo.toString(UnitPrice, "c")#</p> 
    <a id="minus" data-role="button" onclick="minus(#:ProductID#)" >-</a> 
    <label id=#:ProductID#>0</label> 
    <a id="plus" data-role="button" onclick="plus(#:ProductID#)" >+</a> 

    <a id="loginButton" data-role="button" data-click="login">Add to Cart</a> 
    <div class="console"></div> 

</div> 

回答

1

我已经解决了这个问题。我不得不删除线endlessScroll: true我不知道为什么它不与该行一起工作包括在内。