JqGrid 常用操作
topcss opened this issue · 0 comments
topcss commented
var jqGridId = "#grid-table";
// 获取选中行的数据
var rowData = $(jqGridId).getRowData($(jqGridId).jqGrid('getGridParam', 'selrow'));
// 获取多行
var ids = $("#grid-table").getGridParam("selarrrow");
// 刷新列表
$(jqGridId).trigger("reloadGrid");
// 设置单选框(radio)
// × 错误方式
$("input[type='radio']").attr("checked", "checked");
// √ 正确方式
$("input[type='radio']").prop('checked', true);
// 选择列表的内容
eModal.iframe({
"url": '/xxx/List',
"title": "导入项目相关信息",
"buttons": [{ text: '取消', style: 'danger', close: true },
{
text: '确定', style: 'info', close: true, click: function () {
try {
var gridObj = $('.modal-content iframe')[0].contentWindow.$("#grid-table");
var rowData = gridObj.getRowData(gridObj.jqGrid('getGridParam', 'selrow'));
//console.log(rowData);
if (rowData.Id == undefined) {
toastr.warning('请选择需要xxx。', '')
return false;
} else {
}
} catch (ex) { }
}
}]
});
grid.jqParam.loadComplete = function (result) {
var items = result.Items;
}
grid.jqParam.rowNum = 5000;
sortable: false
// 初始化的条件设置
grid.jqParam.postData = {
filters: JSON.stringify(
{
"groupOp": "AND", "rules": [
{ "type": "s", "field": "XCSJ", "op": "eq", "data": $('#sXCSJcn').val() },
{ "type": "s", "field": "SSDW", "op": "eq", "data": "@ViewBag.DeptId" }
]
}
)
};
grid.jqParam.search = true;
filter 相关的API
http://www.trirand.com/jqgridwiki/doku.php?id=wiki:singe_searching#options