Skip to content
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

Merged
merged 2 commits into from
Jun 1, 2015
Merged

[RFR] fix pagination #480

merged 2 commits into from
Jun 1, 2015

Conversation

ThieryMichel
Copy link

No description provided.

@@ -47,9 +47,16 @@ define(function () {

this.ReadQueries
.getAll(this.view, page, true, this.search, this.sortField, this.sortDir)
.then(function (nextData) {
Copy link
Contributor

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 getAllmethod. The third one (true) does not exists anymore.

progression.done();
self.entries = self.entries.concat(nextData.entries);
var references = self.view.getReferences();
Copy link
Contributor

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

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;
}],
.

Copy link
Author

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.

jeromemacias added a commit that referenced this pull request Jun 1, 2015
@jeromemacias jeromemacias merged commit bf4a775 into master Jun 1, 2015
@jeromemacias jeromemacias deleted the fix_pagination branch June 1, 2015 08:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants