daniel-nagy / md-data-table

Material Design Data Table for Angular Material
MIT License
1.9k stars 519 forks source link

Pagination back & forth does not work #136

Closed mrcel closed 9 years ago

mrcel commented 9 years ago

My md-data-table is running almost perfectly. Unfortunately, it is not possible to go back and forth in the pagination. Switching from 5 to 10 or even 15 elements per page is not a problem. And also the number of all elements is not displayed:

bildschirmfoto 2015-09-22 um 18 39 22

Does it have anything to do with {{desserts.count}}? Where is the issue? Thank you!

marcoriesco commented 9 years ago

Try {{desserts.length}}

My example: md-total="{{items._size}}"

mrcel commented 9 years ago

{{desserts.length}} works for me! Thank you! Do you know if .length works as a method to get the size of desserts? Or is it a variable? Best, Marcel

marcoriesco commented 9 years ago

In my case, I had to change the routine of example, and I use an api with HAL, is called restheart.It depends largely on the api and routine that you apply your resources.

In your case you keep the sample intact?

daniel-nagy commented 9 years ago

@mrcel length is a built in array property that returns the length of an array. I'm not sure how it is implemented in the language but I believe it is just a variable that is maintained as things are added / removed.

[1, 2, 3].length === 3 // true

Because I am filtering results on the server the length of my array is not the same as the total number of items in the table, I define a property called count that is the total number of items in the database.