-
Notifications
You must be signed in to change notification settings - Fork 725
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RFR] fix pagination #480
[RFR] fix pagination #480
Conversation
@@ -47,9 +47,16 @@ define(function () { | |||
|
|||
this.ReadQueries | |||
.getAll(this.view, page, true, this.search, this.sortField, this.sortDir) | |||
.then(function (nextData) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You also need to fix parameters passed to getAll
method. The third one (true
) does not exists anymore.
progression.done(); | ||
self.entries = self.entries.concat(nextData.entries); | ||
var references = self.view.getReferences(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You also need to retrieve references and store them into the datastore.
See
ng-admin/src/javascripts/ng-admin/Crud/routing.js
Lines 73 to 118 in a7cc56d
nonOptimizedReferencedData: ['ReadQueries', 'view', 'response', function (ReadQueries, view, response) { | |
return ReadQueries.getFilteredReferenceData(view.getNonOptimizedReferences(), response.data); | |
}], | |
optimizedReferencedData: ['ReadQueries', 'view', 'response', function (ReadQueries, view, response) { | |
return ReadQueries.getOptimizedReferencedData(view.getOptimizedReferences(), response.data); | |
}], | |
referencedEntries: ['dataStore', 'view', 'nonOptimizedReferencedData', 'optimizedReferencedData', function (dataStore, view, nonOptimizedReferencedData, optimizedReferencedData) { | |
var references = view.getReferences(), | |
referencedData = angular.extend(nonOptimizedReferencedData, optimizedReferencedData), | |
referencedEntries; | |
for (var name in referencedData) { | |
referencedEntries = dataStore.mapEntries( | |
references[name].targetEntity().name(), | |
references[name].targetEntity().identifier(), | |
[references[name].targetField()], | |
referencedData[name] | |
); | |
dataStore.setEntries( | |
references[name].targetEntity().uniqueId + '_values', | |
referencedEntries | |
); | |
} | |
return true; | |
}], | |
entries: ['dataStore', 'view', 'response', 'referencedEntries', function (dataStore, view, response, referencedEntries) { | |
var entries = dataStore.mapEntries( | |
view.entity.name(), | |
view.identifier(), | |
view.getFields(), | |
response.data | |
); | |
// shortcut to diplay collection of entry with included referenced values | |
dataStore.fillReferencesValuesFromCollection(entries, view.getReferences(), true); | |
// set entries here ??? | |
dataStore.setEntries( | |
view.getEntity().uniqueId, | |
entries | |
); | |
return true; | |
}], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure all of this is necessary. Because, on my project, the references were correctly retrieved, even the one that were not on the first page.
So it seems to me that the code in routing.js does the job, and don't need to be repeated.
No description provided.