Skip to content

[RFR] fix pagination#480

Merged
jeromemacias merged 2 commits intomasterfrom
fix_pagination
Jun 1, 2015
Merged

[RFR] fix pagination#480
jeromemacias merged 2 commits intomasterfrom
fix_pagination

Conversation

@ThieryMichel
Copy link
Copy Markdown
Contributor

No description provided.

Copy link
Copy Markdown
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.

Copy link
Copy Markdown
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
Copy Markdown
Contributor 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.

2 participants