JQUERY EASY UI checkbox 返回选中行

fox123871 2015-10-12 03:14:01
问题,每次点击按钮获取选中行数,返回结果都是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>
...全文
159 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
fox123871 2015-10-12
  • 打赏
  • 举报
回复
引用 1 楼 cheery_an 的回复:
idField: 'id', 查看下id对应的值是否重复了


引用 1 楼 cheery_an 的回复:
idField: 'id', 查看下id对应的值是否重复了

去掉就好了
cheery_an 2015-10-12
  • 打赏
  • 举报
回复
idField: 'id', 查看下id对应的值是否重复了

87,955

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧