Hi guys,
Newbie's here , I like your wonderful project!
Now i got some trouble,when I set server pagination mode,I try to export all data to excel, but it doesnt work, just got current page ,I have searched all the issues on the site,but can not find out solution. please help~
here is the code:
<script src="/table/js/bootstrap-table.min.js"></script>
<script src="/table/js/bootstrap-table-zh-CN.min.js"></script>
<script src="/table/js/jquery.base64.js"></script>
<script src="/table/js/bootstrap-table-export.js"></script>
<script src="/table/js/tableExport.js"></script>
<script type="text/javascript" src="/table/js/FileSaver.min.js"></script>
<table id="mytab" class="table table-hover" ></table>
$(function() {
$('#mytab').bootstrapTable({
url:'test.php',
dataField: 'rows',
striped:true,
pagination: true,
pageSize: 20,
pageList: [5, 10, 20, 50],
sidePagination: 'server',
contentType: 'application/x-www-form-urlencoded',
dataType: 'json',
method: 'post',
queryParamsType: 'limit',//查询参数组织方式
queryParams: function getParams(params) {
params.other = 'otherInfo';
return params;
},
searchOnEnterKey: false,
showRefresh: true,
showColumns: true,
buttonsAlign: 'left',
toolbar: '#toolbar',
toolbarAlign: 'right',
showFooter:true,
showExport:true,
exportDataType: 'all',
columns: [
{
title: '全选',
field: 'select',
checkbox: true,
width: 20,//宽度
align: 'center',//水平
valign: 'middle'//垂直
},
{
title: 'ID',//标题
field: 'id',//键名
sortable: true,//是否可排序
order: 'desc'//默认排序方式
},
{
field: 'name',
title: 'NAME',
sortable: true,
titleTooltip: 'this is name'
},
{
field: 'age',
title: 'AGE',
sortable: true,
footerFormatter:'sumFormatter'
},
{
field: 'info',
title: 'INFO[using-formatter]',
formatter: 'infoFormatter'//对本列数据做格式化
}
]
});
})
Please update bootstrap table to the latest version, you can check out others issues: https://github.com/wenzhixin/bootstrap-table/search?q=export+server&type=Issues&utf8=%E2%9C%93.
Hi sir,Actually I m used bootstrap table from your website,It should be the lastest version right?
是不是因为我用的server模式,然后查询数据每次返回的数据被limit了,所以在客户端使用export all 的时候,导出的也只能是limit数量的“”全部数据“”呢?
SELECT * FROMtestORDER BY checkouttime desc LIMIT 0,20
Hi, i have same problem. Server side export data not working
Same for me and I don't understand yet what could be wrong.
I found a workaround
In the function load ( BootstrapTable.prototype.load = function (data) { )
I changed the if condition
if (this.options.sidePagination === 'server')
TO
if (this.options.pagination && this.options.sidePagination === 'server')
Line 2388 in file bootstrap-table.js (version 1.11.1), now it export all the data.
Anyway, it's still the best grid that i know, regards.
Yes the fix works. It should be merged to master.
@maguitoon please test latest master as well and confirm the fix is fine.