Closed edenchen123 closed 9 years ago
I think it does, if you export visible rows. The sorted rows are held in the visible rows cache. If you export all, then it uses grid.rows, which is not sorted. If you export visible, then it uses grid.visibleRows, which is sorted. I think this makes sense. If you haven't filtered, then visibleRows and allRows are the same thing, so you could just export visible rows. If you have filtered, then the sort would only apply to the filtered rows - we can't easily export sorted for rows that aren't visible.
Yes, but what about when data is paged? I have paged data and I would like to export all rows using the current sort. I have tried temporarily changing the page size to fit all rows, calling export on visible rows and then setting the page size back, however even with a notification to grid that the page size has changed, the exporter still exports just the current page.
I believe there is now an option to get all paged data before export, it does require handling a callback.
Ah, thanks. Is this exporterAllDataPromise
?
Sounds right.
I'm using angular ui-grid for large set's of data, now i'm able to export the filtered result's from all paginations,when i apply the sort functionality along with it, it works on the view but not on the imported file, that is the user again needs to sort it after the download using excel(which isn't convenient).
NB: Extra dependencies i have used 1.xlsx.js 2.underscore.js 3.alasql.js
function exportData() {
$scope.exportDatalist = _.filter($scope.gridApi.grid.rows, (o) => {
return o.visible;
});
var entities = _.map($scope.exportDatalist, 'entity');
alasql.promise('SELECT * INTO XLSX("Log_Details.xlsx",{headers:true}) FROM ?', [entities]);
}
@csharpengineer @PaulL1 Could you please show here the sample code, can be used to resolve this problem?
export functionality should be able to export sorted data