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>