212
//按需加载
$('a[data-toggle = "tab"]').on('shown.bs.tab', function (e) {
//debugger;
if ('searchTab-tab' == $(e.target).attr("id")) {
return;
}
$(this).find('.dottedTab').hide();
// e.target // 激活的标签页
// e.relatedTarget // 前一个激活的标签页
$('#' + $(e.relatedTarget).attr('id').replace('Tab', '')).empty();
var elmtabId = $(e.target).attr("id")
var url = '/Home/ShouldNArriveOrdersPartialView';
var eventelmId = '_ShouldNArriveOrdersTabId';
if (elmtabId == '_ShouldNArriveOrdersTabId') {
eventelmId = '_ShouldNArriveOrdersId';
url = "/Home/ShouldNArriveOrdersPartialView";
} else if (elmtabId == '_ShouldNDepOrdersTabId') {
eventelmId = '_ShouldNDepOrdersId';
url = "/Home/ShouldNDepOrdersPartialView";
} else if (elmtabId == '_OverdraftLeaveOrdersTabId') {
eventelmId = '_OverdraftLeaveOrdersId';
url = "/Home/OverdraftLeaveOrdersPartialView";
} else if (elmtabId == '_CheckInOrdersTabId') {
eventelmId = '_CheckInOrdersId';
url = "/Home/CheckInOrdersPartialView";
}
autoRefreshOrdersBrowse(eventelmId, elmtabId, url, 1, 10, $("#" + elmtabId).attr('data-value'));
});
//首次加载
autoRefreshOrdersBrowse('_ShouldNArriveOrdersId', '_ShouldNArriveOrdersTabId', '/Home/ShouldNArriveOrdersPartialView', 1, 10, $("#_ShouldNArriveOrdersTabId").attr('data-value'));
//var _pageArr = [];
function autoRefreshOrdersBrowse(eventelmId, elmtabId, url, _pageIndex, _pageSize, totalNum) {
$("#" + eventelmId).autobrowse({
url: function (offset) {
//只监听当前Tab事件
var selectTabId = $('#normalTab').children('.active').children('a').attr('id');
if (selectTabId != elmtabId) {
url = '';
}
return url;
},
template: function (response) {
return response;
},
itemsReturned: function (response) {
return _pageSize
},
offset: 1,
postData: function () {
return { pageIndex: _pageIndex, pageSize: _pageSize }
},
max: totalNum,
dataType: 'html',
sensitivity: 100,
// loader: '<div class="loader"></div>',
complete: function (e) {
_pageIndex++
}
});
};