本文介绍了如何只检查Jq-grid中的一个复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 大家好, 我是Jq Grids的新蜜蜂,所以这里有问题。我有一个jqGrid,网格的每一行都有三个复选框...现在我的要求只有一个复选框可以检查对应每一行...下面是我的代码如何实现这个功能 Hi All,I am a new bee in Jq Grids so here is problem . I have one jqGrid and there are three checkbox in each row of grid... Now my requirment is only one checkbox whould be checked corresponding to each row... Below is my code How I can achieve this functionality $("#BatchQCGrid").jqGrid({ datatype: 'json', colNames: ['Batch ID:"' + accessionId + '"', 'Pos QC', 'Neg QC', 'KeyString', 'Pass', 'Fail', 'Repeat?', 'Comments'], colModel: [ { name: 'Assay', index: 'Assay', width: 50, align: 'center' }, { name: 'PosQC', index: 'PosQC', width: 50, align: 'center' }, { name: 'NegQC', index: 'NegQC', width: 50, align: 'center' }, { name: 'KeyString', index: 'KeyString', width: 100, hidden: true, align: 'center' }, { name: 'Pass', index: 'Pass', formatter: batchPassCheckbox, width: 50, align: 'center' }, { name: 'Fail', index: 'Fail', formatter: batchFailCheckbox, width: 50, align: 'center' }, { name: 'Repeat', index: 'Repeat', formatter: batchRepeatCheckbox, width: 50, align: 'center' }, { name: 'Comments', index: 'Comments', formatter: batchComments, Width: 300, align: 'center' } ], multiselect: false, emptyrecords: "No records to view", pgbuttons: false, viewrecords: true, loadonce: true, altRows: true, height: 'auto' }); dArray = "{"; dArray += "'caseNo': '" + caseno + "',"; dArray += "'rqstMsg': '" + hdnsession + "'"; dArray += "}"; $.ajax({ type: "POST", url: "../../../../ClientSide-Services/Assay.asmx/GetBatchQcData", data: dArray, contentType: "application/json; charset=utf-8", dataType: "json", async: false, success: function(response) { if (response.d != '{"Table" : ]}') { var gd = eval('(' + response.d + ')'); for (row in gd) { $("#BatchQCGrid").jqGrid('addRowData', row, gd[row]); } $("#BatchQCGrid").trigger("reloadGrid"); } else { $("#BatchQCGrid").jqGrid("clearGridData", true).trigger("reloadGrid"); } }, error: function(response) { alert(response.responseText); } });function batchPassCheckbox(cellValue, options, rowobject, action) { var checked = cellValue == 'true' ? " checked='checked' " : ""; var a = "<input type='checkbox' " + checked + " value='" + cellValue + "' id=chkBatchPass />"; return a;}function batchFailCheckbox(cellValue, options, rowobject, action) { var checked = cellValue == 'true' ? " checked='checked' " : ""; var a = "<input type='checkbox' " + checked + " id='chkBatchFail' value='" + cellValue + "'></input>"; return a;}function batchRepeatCheckbox(cellValue, options, rowobject, action) { var checked = cellValue == 'true' ? " checked='checked' " : ""; var a = "<input type='checkbox' " + checked + " id='chkBatchRepeat' value='" + cellValue + "'></input>"; return a;} 我的要求是假设如果我点击第一个Pass复选框,之后我点击Fail Check-box比通行复选框应该是未选中的意味着只应检查一个检查boc应该检查网格中的每一行...帮助代码将不胜感激请帮助我..... My requirement is suppose if I click first Pass check-box after that I click on Fail Check-box than Pass check box should be unchecked means only one check boc should be checked for each row in the grid... Help with code would be appreciated please help me .....推荐答案 这篇关于如何只检查Jq-grid中的一个复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-27 09:11