原創(chuàng)|使用教程|編輯:龔雪|2020-10-29 11:19:24.580|閱讀 242 次
概述:Kendo UI for jQuery是創(chuàng)建現(xiàn)代Web應(yīng)用程序的最完整UI庫,本文將為大家介紹Kendo UI ListView Selection功能,歡迎下載最新版體驗!
# 界面/圖表報表/文檔/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四個控件。Kendo UI for jQuery是創(chuàng)建現(xiàn)代Web應(yīng)用程序的最完整UI庫。
默認情況下,ListView的選擇功能處于禁用狀態(tài)。
ListView通過將selectable屬性設(shè)置為“ single”或“ multiple”來支持項目選擇功能。
$("#listView").kendoListView({ dataSource: dataSource, selectable: "multiple", template: kendo.template($("#template").html()) });
您還可以檢測用戶何時通過更改事件獲得項目,該事件是通過使用Shift + select組合選擇一個或多個項目時觸發(fā)的。
$("#listView").kendoListView({ change: function(e) { var data = dataSource.view(); var selected = $.map(this.select(), function(item) { return data[$(item).index()].ProductName; }); // Index selected or read item information through data. } });
下面的示例演示了建議方法的完整實現(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> 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({ selectable: true, dataSource: dataSource, template: kendo.template($("#template").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)