欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

BootStrap Table后臺分頁時前臺刪除最后一頁所有數(shù)據(jù)refresh刷新后無數(shù)據(jù)問題

 更新時間:2016年12月28日 15:48:25   作者:荒蕘蕪  
這篇文章主要介紹了BootStrap Table后臺分頁時前臺刪除最后一頁所有數(shù)據(jù)refresh刷新后無數(shù)據(jù)問題,需要的朋友可以參考下

主要是頁碼超出范圍帶來的問題,僅在此記錄一下,這里我通過修改bootstrap-table.js的initServer方法中的查詢success回調(diào)函數(shù)解決,將該回調(diào)函數(shù)改為:

function (res) { 
    /**TODO:2016-12-20新加的代碼,處理頁碼錯誤問題開始*/ 
    if(res.total!=0&&res.rows.length==0){//總記錄數(shù)大于0,但當(dāng)前頁記錄數(shù)為0,則此時頁碼超過了最大頁碼誤 
     that.options.pageNumber = Math.ceil(res.total/that.options.pageSize);//最后一頁(總頁數(shù)) 
     that.initServer(); 
     return; 
    } 
    /**2016-12-20新加的代碼,處理頁碼錯誤問題結(jié)束*/ 
    res = calculateObjectValue(that.options, that.options.responseHandler, [res], res); 
    that.load(res); 
    that.trigger('load-success', res); 
   } 

當(dāng)總記錄數(shù)不為0而當(dāng)前頁的記錄數(shù)為0時將頁碼設(shè)為最后一頁重新請求數(shù)據(jù),即:

if(res.total!=0&&res.rows.length==0){//總記錄數(shù)大于0,但當(dāng)前頁記錄數(shù)為0,則此時頁碼超過了最大頁碼誤 
     that.options.pageNumber = Math.ceil(res.total/that.options.pageSize);//最后一頁(總頁數(shù)) 
     that.initServer(); 
     return; 
    }

以上所述是小編給大家介紹的BootStrap Table后臺分頁時前臺刪除最后一頁所有數(shù)據(jù)refresh刷新后無數(shù)據(jù)問題,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復(fù)大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!

相關(guān)文章

最新評論