【发布时间】:2017-02-27 22:26:40
【问题描述】:
我正在使用 Jqgrid 示例创建一个表,我正在尝试获取所有选中行的值并使用 ajax 将选定的值传递给服务器。
当前,当我单击获取选定按钮时,它没有获取选定的值。
这里是我的fiddle的链接
另外,是否可以为每一行添加单选按钮,并且在整个表格中只能选择一个单选按钮。
/***********************/
$("#getSelected").click(function() {
var ids = $("#output").jqGrid('getGridParam', 'selarrrow');
if (ids.length > 0) {
var names = [];
for (var i = 0, il = ids.length; i < il; i++) {
var name = $("#output").jqGrid('getCell', ids[i], 'Symbol');
names.push(name);
}
//alert ("Names: " + names.join(", ") + "; ids: " + ids.join(", "));
$("#names").html(names.join(", "));
$("#dialog-confirm").dialog({
height: 280,
modal: true,
buttons: {
'Cancel': function() {
$(this).dialog('close');
},
'Confirm': function() {
alert("Confirm");
//alert ("Names: " + names.join(", ") + "; ids: " + ids.join(", "));
/*$.ajax({
type: "POST",
url: "/cpsb/unprocessedOrders.do",
data: { method: "releaseTowics",
orderNum: JSON.stringify(ids),
names: JSON.stringify(names)
},
dataType: "json"
success: function(msg){
alert(msg);
},
error: function(res, status, exeption) {
alert(res);
}
});*/
}
}
});
}
});
/***********************/
【问题讨论】:
标签: javascript jquery jqgrid