Zizzamia / ng-tasty

A tasty collection of reusable UI components for Angular, like grandma used to make. Like Table directive, WebSocket / Debounce / Throttle service, Range / Camelize / Slugify filters
MIT License
435 stars 64 forks source link

Override pagination variables #199

Closed aboardamit closed 8 years ago

aboardamit commented 8 years ago

Hi, as per Server side Table complete example, the expected pagination object array is:

"pagination": {
    "count": 5,
    "page": 1,
    "pages": 4,
    "size": 20
  }

However, my rest service returns pagination array in different format and I have no control to override the same.

"last": false,
"totalPages": 2,
"totalElements": 5,
"size": 3,
"number": 0

How can I implement the pagination in this scenario? Is there a way to customise the pagination parameters?

return {
      'rows': response.data.rows,
      'header': response.data.header,
      'pagination': response.data.pagination,
      'sortBy': response.data['sort-by'],
      'sortOrder': response.data['sort-order']
    }
aboardamit commented 8 years ago

I have managed to resolve the issue.

'pagination': 
{
  'count': response.data['size'],
  'page' : response.data['number'],
  'pages': response.data['totalPages'],
  'size' : response.data['totalElements']
},
'sortBy': response.data.sort['property'],
'sortOrder': response.data.sort['direction']
Zizzamia commented 8 years ago

:+1: