翻譯|使用教程|編輯:龔雪|2020-10-20 10:21:07.463|閱讀 221 次
概述:Kendo UI for jQuery是創(chuàng)建現(xiàn)代Web應(yīng)用程序的最完整UI庫,本文將為大家介紹Kendo UI ListView Items的使用,歡迎下載最新版體驗(yàn)!
# 界面/圖表報(bào)表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關(guān)鏈接:
Kendo UI for jQuery R3 2020試用版下載
Kendo UI目前最新提供Kendo UI for jQuery、Kendo UI for Angular、Kendo UI Support for React和Kendo UI Support for Vue四個(gè)控件。Kendo UI for jQuery是創(chuàng)建現(xiàn)代Web應(yīng)用程序的最完整UI庫。
您的項(xiàng)目可能需要在可視化上區(qū)分ListView中的每個(gè)替代項(xiàng)。
例如,您可能需要在稍暗的背景(帶狀行)中渲染第二個(gè)項(xiàng)目。 要在ListView中呈現(xiàn)交替項(xià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="http://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="http://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="http://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="http://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: "http://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>
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請郵件反饋至chenjj@fc6vip.cn
文章轉(zhuǎn)載自:慧都網(wǎng)