var lastsel3; var url = "http://" + location.host + "/ActionSubmitAndAudit.aspx/ActionAuditDetailShow2"; mygrid = $("#list").jqGrid({ width: 800, height: 450, url: url, datatype: 'json', mtype: 'POST', // pager: jQuery('#pager'), rowNum: 20, rowList: [20, 40, 60, 80], sortname: 'Id', sortorder: "desc", viewrecords: true, imgpath: '/scripts/themes/steel/images', caption: '查询条件:', recordtext: '条记录', loadtext: 'loading....', colNames: ['网吧名称', '活动日期', '活动开始时间', '活动结束时间', '包机数量', '活动费用', '选择通过', '网吧ID'], colModel: [{ name: 'barname', index: 'BARNAME', width: 160, align: 'center' }, { name: 'subtime', index: 'SUBTIME', width: 160, align: 'center' }, { name: 'starttime', index: 'STARTTIME', width: 160, align: 'center' }, { name: 'endtime', index: 'ENDTIME', width: 160, align: 'center' }, { name: 'cnum', index: 'CNUM', width: 160, align: 'center' }, { name: 'actcost', index: 'ACTCOST', width: 160, align: 'center' }, { name: 'importbool', index: 'IMPORTBOOL', width: 160, align: 'center', editable: true, edittype: "checkbox", editoptions: { value: "True:False"} }, { name: 'actdid', index: 'ACTDID', width: 0, align: 'center', hide: "true" }, ], loadComplete: function() { var sumrecords = $("#list").getGridParam("records"); if (sumrecords != null) { $('#totalsum').text(sumrecords); } for (icount = $("#list")[0].rows.length - 1; icount >= 1; icount--) { jQuery('#list').editRow(icount); //记录所有行号 if (icount == $("#list")[0].rows.length - 1) { idstring = icount; } else { idstring = idstring + "," + icount; } //把已沟选的行,打上沟 var rowNetbarid = mygrid.getRowData(icount).actdid; if (selectedRows.indexOf(";" + rowNetbarid + ";") >= 0) { $('#' + icount + "_importbool").attr('checked', 'true'); } } }, onSelectRow: function(id) { if (id && id !== lastsel3) { $("#list").restoreRow(idstring); jQuery('#list').editRow(id); lastsel3 = lastsel3 + "," + id; } if ($('#' + id + "_importbool").attr('checked') == true) { selectedRows = selectedRows + ";" + mygrid.getRowData(id).actdid + ";" + ","; } else { if (selectedRows.indexOf(";" + mygrid.getRowData(id).actdid + ";") >= 0) { selectedRows = selectedRows.replace(";" + mygrid.getRowData(id).actdid + ";" + ",", ""); } } //记忆勾选的actdid,用逗号分割,放在变量actdidRows中,记忆勾选的StatusRows,用逗号分割,放在变量StatusRows中 actdidRows = ""; StatusRows = ""; for (icount = $("#list")[0].rows.length - 1; icount >= 1; icount--) { if ($('#' + icount + "_importbool").attr('checked') == true) { actdidRows = actdidRows + mygrid.getRowData(icount).actdid + ","; StatusRows = StatusRows + "1,"; } else { actdidRows = actdidRows + mygrid.getRowData(icount).actdid + ","; StatusRows = StatusRows + "2,"; } } } // onCellSelect: function(rowid) { // jQuery('#list').restoreRow(lastsel3); // jQuery('#list').editRow(rowid, true, pickdates); // lastsel3 = rowid; // } });