mardi 4 octobre 2016

spring boot pagination with ember data

Hi I want to create a pagination for my application for that i am using spring-boot Pagination and ember-cli-pagination. Before using spring-boot pagination, rest controller returns data in the following format,

[{
"id" : 56789,
"name" : "sample book",
"status": "available",
},{
"id" : 56789,
"name" : "sample book",
"status": "available",
}]

after using spring-pagination my rest controller returns data in the format,

{
"content": 
[{
"id" : 56789,
"name" : "sample book",
"status": "available",
},{
"id" : 56789,
"name" : "sample book",
"status": "available",
}],
"last": true,
"totalElements": 5,
"totalPages": 2,
"size": 3,
"number": 1,
"sort": null,
"first": false,
"numberOfElements": 2
}

Now the structure of the data completely changes so i need to modify my ember model so that ember data will properly serialize my data.

Is there any other way to apply spring-boot-pagination to ember data with minimal changes?Any standard or guided way to do that?

Do i really need to change my ember model?

Ember Model :

export default DS.Model.extend({
   id: DS.attr(),
   name: DS.attr(),
   status: DS.attr()
});

Any help should be appreciable.




Aucun commentaire:

Enregistrer un commentaire