Skip to content

Commit

Permalink
Hide stateField before export and show after
Browse files Browse the repository at this point in the history
  • Loading branch information
Flounn committed Jan 3, 2018
1 parent 4228fa6 commit 4d1e803
Showing 1 changed file with 23 additions and 7 deletions.
30 changes: 23 additions & 7 deletions src/extensions/export/bootstrap-table-export.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,32 +129,48 @@
that.load(data);
}
};

var stateField = that.header.stateField;

if (that.options.exportDataType === 'all' && that.options.pagination) {
that.$el.one(that.options.sidePagination === 'server' ? 'post-body.bs.table' : 'page-change.bs.table', function () {
if (stateField){
that.hideColumn(stateField);
}
doExport();
that.togglePagination();
});
that.togglePagination();
} else if (that.options.exportDataType === 'selected') {
var data = that.getData(),
selectedData = that.getAllSelections();
selectedData = that.getSelections();
if (!selectedData.length)
return;

// Quick fix #2220
if (that.options.sidePagination === 'server') {
data = {total: that.options.totalRows};
data[that.options.dataField] = that.getData();

selectedData = {total: that.options.totalRows};
selectedData[that.options.dataField] = that.getAllSelections();
var dataServer = {total: that.options.totalRows};
dataServer[that.options.dataField] = data;
data = dataServer;
var selectedDataServer = {total: selectedData.length};
selectedDataServer[that.options.dataField] = selectedData;
selectedData = selectedDataServer;
}

that.load(selectedData);
if (stateField){
that.hideColumn(stateField);
}
doExport();
that.load(data);
} else {
if (stateField){
that.hideColumn(stateField);
}
doExport();
}
if (stateField){
that.showColumn(stateField);
}
});
}
}
Expand Down

0 comments on commit 4d1e803

Please sign in to comment.