AABBbaby

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

Kendo UI ListView选择功能,让Web开发更轻松

Kendo UI for jQuery R3 2020 SP1试用版下载

Kendo UI目前最新提供Kendo UI for jQuery、Kendo UI for Angular、Kendo UI Support for React和Kendo UI Support for Vue四个控件。Kendo UI for jQuery是创建现代Web应用程序的最完整UI库。

默认情况下,ListView的选择功能处于禁用状态。

入门指南

ListView通过将selectable属性设置为“ single”或“ multiple”来支持项目选择功能。

 

$("#listView").kendoListView({
dataSource: dataSource,
selectable: "multiple",
template: kendo.template($("#template").html())
});
高级配置

您还可以检测用户何时通过更改事件获得项目,该事件是通过使用Shift + select组合选择一个或多个项目时触发的。

$("#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.
}
});

下面的示例演示了建议方法的完整实现。

<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>
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({
selectable: true,
dataSource: dataSource,
template: kendo.template($("#template").html())
});
</script>

<style>
.alt { background-color: #EEE; }
</style>

了解最新Kendo UI最新资讯,请关注Telerik中文网!

posted on   AABBbaby  阅读(153)  评论(0编辑  收藏  举报

编辑推荐:
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!
历史上的今天:
2019-10-30 项目管理工具!DevExpress Winforms Gantt控件 v19.2强势来袭
2018-10-30 DevExpress v18.1新版亮点——XAF篇(一)
2017-10-30 【DevExpress v17.2新功能预告】改进DevExtreme编辑器
点击右上角即可分享
微信分享提示