0
我有下面的代码在我的jqGridjqGrid的编辑按钮访问一组复选框被选中
<script type="text/javascript">
jQuery(document).ready(function() {
var grid = jQuery("#list");
$("#editBtn").click(function() {
alert("hi"); });
jQuery("#list").jqGrid({
url: '<%= Url.Action("DynamicGridData") %>',
datatype: 'json',
mtype: 'POST',
colNames: ['checkbox', 'Id','col1','col2' ],
colModel: [
{ name: 'checkbox', index: 'checkbox', sortable: false, formatter: "checkbox", formatoptions: { disabled: false }, editable: true, edittype: "checkbox" },
{ name: 'Id', index: 'Id', search: false, stype: 'text', sortable: true, sorttype: 'int', hidden: true },
{ name: 'col1', index: 'col1', search: false, stype: 'text', sortable: true, sorttype: 'int', search: false, hidden: true },
{ name: 'col2', index: 'col2', sortable: true, search: false, width: 30, stype: 'int' } ],
pager: jQuery('#pager'),
rowNum: 40,
rowList: [20, 40, 60, 100],
sortname: 'Id',
sortorder: 'asc',
gridview: true,
autowidth: true,
rownumbers: true,
viewrecords: true,
toppager: true,
height: "100%",
width: "100%",
caption: 'Grid Data'
});
});
我可以在editBtn功能触发警报测试,用户怎样才能访问的id列记录的用户选择了其复选框?
谢谢Sandeep,我想出了一种方法,并没有机会测试你的,但它几乎是类似的,所以我会发布我的,并选择它答案var grid = jQuery(“#list”);对于(var i = 0; i()),我们可以使用下面的代码:var(“#”); (inputs.length; i ++){ if(inputs [i] .type =='checkbox'&& inputs [i] .checked){ var p = inputs [i] .parentNode.parentNode; alert(id); }}}); – Sue 2011-05-20 16:30:44
好..多数民众赞成的替代方法...我使用的是jqgrid元素,你使用的HTML元素...感谢张贴替代方式... – Sandeep 2011-05-23 09:28:18