Skip to content

Commit

Permalink
Fix ng-admin issue #738
Browse files Browse the repository at this point in the history
exportToCsv function was failing to correctly (re)load data in a new
filtered page. This was due to an incorrect search parameters given
to the ReadQueries getAll function. Using $stateParams' search
attribute (instead of scope.search()) solves the issue.
  • Loading branch information
Luca Valtulina committed Dec 7, 2015
1 parent 23a6bac commit 2801917
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/javascripts/ng-admin/Crud/button/maExportToCsvButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ export default function maExportToCsvButton ($stateParams, Papa, notification, A
scope: {
entity: '&',
label: '@',
datastore: '&',
search: '&'
datastore: '&'
},
link: function(scope) {
scope.label = scope.label || 'Export';
Expand All @@ -30,7 +29,7 @@ export default function maExportToCsvButton ($stateParams, Papa, notification, A
var nonOptimizedReferencedData;
var optimizedReferencedData;

ReadQueries.getAll(exportView, -1, scope.search(), $stateParams.sortField, $stateParams.sortDir)
ReadQueries.getAll(exportView, -1, $stateParams.search, $stateParams.sortField, $stateParams.sortDir)
.then(response => {
rawEntries = response.data;
return rawEntries;
Expand Down

1 comment on commit 2801917

@yaoelvon
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find this bug, then I find the solution there.Thank you!

Please sign in to comment.