Authored by ZhongW

分页多选bug

... ... @@ -438,7 +438,7 @@ grid.prototype = {
g.selected.push(g.rows[index]);
}else{
/**************业务控制 特殊情况**************/
if(window.batchOperateShelve){
if(window.batchOperateShelve && $.inArray(g.rows[index]['productSkn'], window.batchOperateShelve) != -1 ){
window.batchOperateShelve.splice($.inArray(g.rows[index]['productSkn'],window.batchOperateShelve),1);
}
/********************************************/
... ...
... ... @@ -84,6 +84,7 @@ var t = new common.tab2({
sortFlag = 1;
}
batchOperateShelve = [];
pageSkn = [];
g.init("/goods/netsale/getList");
},
columns: [{
... ... @@ -109,6 +110,7 @@ var t = new common.tab2({
}]
}).init(ENUM.tab);
var pageSkn = [];
var g = new common.grid({
el: "#basicTable",
usepagesize:true,
... ... @@ -342,7 +344,18 @@ var g = new common.grid({
HtmArr.push('<a href="javascript:;" class="btn btn-success btn-xs brandSort-btn" data-index="' + item.__index + '" >品牌排序</a>');
return HtmArr.join('');
}
}]
}],
complete:function(){
//渲染表头是否勾选
$.each(pageSkn, function (i, pageItem) {
if($.inArray(pageItem, batchOperateShelve) == -1 ) {
return false;
}
$(".wqt_all").prop("checked", true);
});
pageSkn = [];
}
});
g.init("/goods/netsale/getList");
... ... @@ -642,11 +655,12 @@ $(document).on("click", ".btnsku", function () {
})
});
window._count1 = 0;
window._count2 = 0;
$(document).on("change", ".wqt_checkbox,.wqt_all", function () {
var _count1 = 0,
_count2 = 0,
_isAdvance0 = 0,
var _isAdvance0 = 0,
_isAdvance1 = 0;
$.each(g.selected, function (index, item) {
/*添加兼容逻辑*/
if (item.status == 8 || item.status == 3 || item.status == 2 || item.status == 0) {
... ... @@ -663,16 +677,17 @@ $(document).on("change", ".wqt_checkbox,.wqt_all", function () {
});
if (_isAdvance0 && _isAdvance1) {
$('#onshelve').addClass('disabled');
$('#offshelve').addClass('disabled');
return;
}
if (_count1 == g.selected.length) {
if (_count1 > 0 ) {
$('#onshelve').removeClass('disabled');
} else {
$('#onshelve').addClass('disabled');
}
if (_count2 == g.selected.length) {
if (_count2 > 0) {
$('#offshelve').removeClass('disabled');
} else {
$('#offshelve').addClass('disabled');
... ...