如何在jqgrid中设置checkbox多选,及获取多选的值(学习笔
记)
//JS
$(function() {
var table=$('#grid-table')[0];
createDictSelect('select-ywbk', 'ywbk');
createDictSelect('select-fwlx', 'fwlx');
createDictSelect('select-ywlx', 'ywlx');
createCustomer('select-gszx','');
createDepart("select-kfbz","zxfz");
$('#rdYtime_begin').val(getCurrentDay()+' 00:00:00');
$('#rdYtime_end').val(getCurrentDayTime());
var grid_url = "${ctx}/admin/rcd/list";//查询列表接⼝
var _colnames = [ "序号", "客户名称", "沟通时间", "通话号码", "分类","业务板块","服务类型", "业务类型", "客服⼯号","归属坐席","客服分组", "沟通记录" ,"播放","操作"];
var _colmodel = [
{
name : "id",
index : "id",
hidden : true
},
{
name : "cust_name",
index : "cust_name"
},
{
name : "rd_time",
index : "rd_time"
},
{
name : "rcd_cust_phone",
index : "rcd_cust_phone"
},
{
replaceall()
name : "rcd_cdr_type",
index : "rcd_cdr_type",
},
{
name : "rcd_class",
index : "rcd_class"
},
{
name : "rcd_appeal_type",
index : "rcd_appeal_type"
},
{
name : "rcd_business_type",
index : "rcd_business_type"
},
{
name : "ag_no",
index : "ag_no"
},{
name : "ag_name",
index : "ag_name"
},
{
name : "depart_name",
index : "depart_name"
},
{
name : "rd_content",
index : "rd_content",
editable : true
},
{
name : "recodingfile",
index : "recodingfile",
formatter : function(cellvalue, options, rowObject) {
var dateTime = rowObject.rd_time;
var fromno = '';
var tono = '';
var d_cdr_type;
if('呼⼊'==type){
d_cust_phone;
tono=rowObject.ag_ext;
}else{
d_cust_phone;
fromno=rowObject.ag_ext;
}
/* var date = dateTime.split(' ')[0].replaceAll('-','/');
var file_ = '${dingfile}'+date+'/'+dingfile; */
var
html = '<div οnclick="btn_recording(\''
+ tono
+ '\',\''
+ fromno
+ '\',\''
+ dateTime
+ '\')" class="btn btn-minier btn-primary"><span class="glyphicon glyphicon-play-circle"></span></div>';
return html;
}
},{
name : "",
index : "opreation",
/* formatter : function(cellvalue, options, rowObject) {
var html = '<@shiro.hasPermission name="sys:customer:edit"><button οnclick="btn_detail(\'' + rowObject.id
+ '\')" class="btn btn-minier btn-primary">编辑</button></@shiro.hasPermission>';
return html;
}, */
sortable : false
}
];
//canv_init_gridb(grid_url, _colnames, _colmodel,'rd_time','desc');
$(grid_selector).jqGrid(
{
url : grid_url,
datatype : "json",
mtype : 'POST',
shrinkToFit : true,// 适⽤于较少字段,响应式
colNames : _colnames,
colModel : _colmodel,
jsonReader : {
id : "id"
},
 multiselect: true,//可多选
onSelectRow: function (rowId, status, e) {
var rowIds = jQuery("#grid-table").jqGrid('getGridParam', 'selarrrow');    //获取勾选记录的ID
/***********勾选导出*************/
$('#btn-out').on('click', function() {
parent.location.href = '${ctx}/admin/rcd/export?filter='+'filter__id='+rowIds;
layer_chose();
return false;
});
/*********导出*********end*******/
},
pager : "#grid-pager",
rowNum : 25, //每页显⽰记录数
viewrecords : true, //是否显⽰⾏数
rowList : [ 25, 50, 100, 200, 500 ], //可调整每页显⽰的记录数
postData : {
filter : 'filter__ct_mobile=-1',
sort : 'rd_time',
order : 'desc'
}
});
重点:multiselect: true,//可多选
onSelectRow: function (rowId, status, e) {
var rowIds = jQuery("#grid-table").jqGrid('getGridParam', 'selarrrow');    //获取勾选记录的ID

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。