87,986
社区成员
发帖
与我相关
我的任务
分享
<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>