bootstrap-table中實現(xiàn),翻頁之后再返回,依然選中的情況,具體內(nèi)容如下
//var productids = $("body",window.parent.frames[0].document).find('.ptids');//textarea存放數(shù)據(jù) var productids = $('textarea'); var merge_order_object= {};//頁碼+id組成的對象 var jsonObj = {}; var current_page = "";//當(dāng)前頁碼 //表格渲染完成操作 table.on('post-body.bs.table', function (e, settings, json, xhr) { var merge_order_arr = []; var objString = productids.val(); if(objString !== ""){ jsonObj = JSON.parse(objString);//轉(zhuǎn)換為json對象 $.map(jsonObj, function (arr) { // merge_order_arr.push.apply(merge_order_arr,arr);//合并數(shù)組 merge_order_arr = merge_order_arr.concat(arr);//合并數(shù)組 }); $.each(settings,function (i,v) { $.each(merge_order_arr,function (index,value) { if(v.id === parseInt(value)){ $(e.target).find('tbody tr').eq(i).find('input').click(); } }); }); // productids.val( objString ); } // debugger; }); $('input[name="btSelectAll"], table tbody, input[name="btSelectItem"]').change(function () {//復(fù)選框 current_page = table.bootstrapTable('getOptions').pageNumber; merge_order_object[current_page] = Table.api.selectedids(table); productids.val( JSON.stringify(merge_order_object) );//轉(zhuǎn)換成字符串 });
聲明:本網(wǎng)頁內(nèi)容旨在傳播知識,若有侵權(quán)等問題請及時與本網(wǎng)聯(lián)系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com