Kendo UI目前最新提供KendoUI for jQuery、KendoUI for Angular、KendoUI Support for React和KendoUI Support for Vue四個(gè)控件。Kendo UI for jQuery是創(chuàng)建現(xiàn)代Web應(yīng)用程序的完整UI庫。

Items
您的項(xiàng)目可能需要在可視化上區(qū)分ListView中的每個(gè)替代項(xiàng)。
例如,您可能需要在稍暗的背景(帶狀行)中渲染第二個(gè)項(xiàng)目。要在ListView中呈現(xiàn)交替項(xiàng),請(qǐng)通過定義altTemplate屬性來設(shè)置模板。
<div id=”listView”></div>
<div class=”k-page-wrap”>
<div id=”pager”></div>
</div>
<script type=”text/x-kendo-tmpl” id=”template”>
<div class=”product”>
<img src=”https://demos.telerik.com/kendo-ui/content/web/foods/#= ProductID#.jpg” alt=”#: ProductName # image” />
<h3>#:ProductName#</h3>
<p>#:kendo.toString(UnitPrice, “c”)#</p>
</div>
</script>
<script type=”text/x-kendo-tmpl” id=”altTemplate”>
<div class=”product alt”>
<img src=”https://demos.telerik.com/kendo-ui/content/web/foods/#= ProductID#.jpg” alt=”#: ProductName # image” />
<h3>#:ProductName#</h3>
<p>#:kendo.toString(UnitPrice, “c”)#</p>
</div>
</script>
下面的示例演示了建議方法的完整實(shí)現(xiàn)。
<div id=”listView” style=”max-height:400px;overflow:auto;”></div>
<div class=”k-pager-wrap”>
<div id=”pager”></div>
</div>
<script type=”text/x-kendo-tmpl” id=”template”>
<div class=”product”>
<img src=”https://demos.telerik.com/kendo-ui/content/web/foods/#= ProductID#.jpg” alt=”#: ProductName # image” />
<h3>#:ProductName#</h3>
<p>#:kendo.toString(UnitPrice, “c”)#</p>
</div>
</script>
<script type=”text/x-kendo-tmpl” id=”altTemplate”>
<div class=”product alt”>
<img src=”https://demos.telerik.com/kendo-ui/content/web/foods/#= ProductID#.jpg” alt=”#: ProductName # image” />
<h3>#:ProductName#</h3>
<p>#:kendo.toString(UnitPrice, “c”)#</p>
</div>
</script>
<script>
var dataSource = new kendo.data.DataSource({
transport: {
read: {
url: “https://demos.telerik.com/kendo-ui/service/Products”,
dataType: “jsonp”
}
},
pageSize: 3
});
$(“#pager”).kendoPager({
dataSource: dataSource
});
$(“#listView”).kendoListView({
dataSource: dataSource,
template: kendo.template($(“#template”).html()),
altTemplate: kendo.template($(“#altTemplate”).html()),
});
</script>
<style>
.alt { background-color: #EEE; }
</style>
京ICP備09015132號(hào)-996 | 違法和不良信息舉報(bào)電話:4006561155
© Copyright 2000-2026 北京哲想軟件有限公司版權(quán)所有 | 地址:北京市海淀區(qū)西三環(huán)北路50號(hào)豪柏大廈C2座11層1105室
北京哲想軟件集團(tuán)旗下網(wǎng)站:哲想軟件 | 哲想動(dòng)畫