Skip to content

Commit

Permalink
use current list order to export to csv
Browse files Browse the repository at this point in the history
  • Loading branch information
ThieryMichel committed Apr 1, 2015
1 parent c8128c3 commit 223cb15
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
3 changes: 1 addition & 2 deletions src/javascripts/ng-admin/Crud/button/maExportToCsvButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ define(function () {
var formatEntry = entryFormater($scope.entity.listView().exportFields());

$scope.exportToCsv = function () {
var filter = $stateParams.search;

RetrieveQueries.getAll($scope.entity.listView(), -1, true, filter).then(function (response) {
RetrieveQueries.getAll($scope.entity.listView(), -1, true, $stateParams.search, $stateParams.sortField, $stateParams.sortDir).then(function (response) {
var results = [], entries = response.entries;
for (var i = entries.length - 1; i >= 0; i--) {
results[i] = formatEntry(entries[i]);
Expand Down
11 changes: 7 additions & 4 deletions src/javascripts/ng-admin/Crud/repository/RetrieveQueries.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,13 @@ define(function (require) {
* @returns {promise} the entity config & the list of objects
*/
RetrieveQueries.prototype.getRawValues = function (listView, page, filters, sortField, sortDir) {
var params = {
_page: (typeof (page) === 'undefined') ? 1 : parseInt(page, 10),
_perPage: listView.perPage()
};
var params = {};

if (page !== -1 ) {
params._page = (typeof (page) === 'undefined') ? 1 : parseInt(page, 10);
params._perPage = listView.perPage();
}

if (sortField && sortField.split('.')[0] === listView.name()) {
params._sortField = sortField.split('.')[1];
params._sortDir = sortDir;
Expand Down

0 comments on commit 223cb15

Please sign in to comment.