jqgrid 헤더에서 다중 선택 확인란을 클릭 할 때 Oleg가 응답하는 것을 보았습니다 . 확인란이 비활성화되면 확인이 제거됩니다. (correct me if i'm wrong)
. 하지만 제 경우에는 rowdata를 건너 뛰고 싶거나 row value 인 경우 확인란을 선택하고 싶지 않습니다 Status is approved
.
나는 이것을 시도했다
onSelectAll: function (aRowids, status) {
$.each(aRowids, function (i, val) {
var gridId = "#List";
var rowData = jQuery(gridId).jqGrid('getRowData', val);
var g = $("#List");
var cbs = $("tr.jqgrow > td > " + rowData.Status == "Approved", g[0]);
cbs.removeAttr("checked");
}
}
하지만 아무 일도 일어나지 않습니다. 여전히 승인 된 상태를 확인합니다.
여기에 해결책이 있습니다. http://jsfiddle.net/HJema/632/
var myData = [{
id: 1,
status: "Rejected"
}, {
id: 2,
status: "Approved"
}, {
id: 3,
status: "Rejected"
}, ];
$("#list").jqGrid({
datatype: "local",
colNames: ["Id", "Status"],
colModel: [{
name: "id",
index: "id",
sorttype: "int"
}, {
name: "status",
index: "status"
}],
caption: "Viz Test",
pager: '#pager',
search: true,
multiselect: true,
data: myData,
loadComplete: function(data) {
for (var i = 0; i < data.rows.length; i++) {
if(data.rows[i].status == "Approved"){
$('#jqg_list_' + (i+1)).attr('disabled', true);
}
}
}
});
<link href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css" rel="stylesheet"/>
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.14/themes/base/jquery-ui.css" rel="stylesheet"/>
<link href="http://trirand.com/blog/jqgrid/themes/ui.jqgrid.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script src="http://trirand.com/blog/jqgrid/js/jquery.jqGrid.min.js"></script>
<script src="http://trirand.com/blog/jqgrid/js/i18n/grid.locale-en.js"></script>
<table id="list"></table>
<div id="pager"></div>
Stackoverflow 스 니펫에 문제가 있습니다. jsfiddle을 참조하세요.
이것이 당신을 도울 수 있기를 바랍니다
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다