JQUERY EASY UI checkbox 返回选中行

fox123871 fox123871 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
问题,每次点击按钮获取选中行数,返回结果都是1,以下为代码部分

<script type="text/javascript">

$(document).ready(function () {

$('#btnGetSelectRow').click(function () {
var checkedItems = $("#tt").datagrid("getChecked");
var names = [];
window.alert(checkedItems.length);
$.each(checkedItems, function (index, item) {
names.push(item.UID);
});
$("#divContent").html(names.join(","));
});

$('#tt').datagrid({
idField: 'id',
title: '神器大表格',
iconCls: 'icon-save',
width: 600,
height: 300,
loadMsg: "正在努力加载数据,请稍后...",
url: '../TestHandler.ashx',
method: 'get',
rownumbers: true,
fit: false,//填充
striped: true,//交替背景行
collapsible: true,
columns: [[
{ field: 'ck', checkbox: true },
{ field: 'UID', title: '序号', width: 100 },
{ field: 'UCODE', title: '用户编号', width: 100 },
{ field: 'PWD', title: '密码', width: 100, align: 'right' },
{ field: 'AGE', title: '年龄', width: 100, align: 'right' },
]],
singleSelect: false,
selectOnCheck: true,
checkOnSelect: true
});
});

</script>

以下为HTML内容
<input type="button" value="获取选中行内容" id="btnGetSelectRow" />
<hr />
<table id="tt"></table>
<hr />
<div id="divContent"></div>
...全文

相关推荐

评论 2
收藏 已收藏
分享
返回顶部
fox123871
JavaScript 87,983 成员 224,681 内容