-
Notifications
You must be signed in to change notification settings - Fork 512
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
Getting number of items in table in pagination template #327
Comments
Actually I meant the total number of items in the table after filtering. |
My table is doing everything on the client side (i.e., doesn't make server call) so I apologize but I don't see how issue #304 answers my question. |
sorry wrong link #261 :) |
you can use for example .directive('stSummary', function () {
return {
restrict: 'E',
require: '^stTable',
template: '<div>records:{{size}}</div>',
scope: {},
link: function (scope, element, attr, ctrl) {
scope.$watch(ctrl.getFilteredCollection, function (val) {
scope.size = (val || []).length;
})
}
}
}) to display the number of records which match And if you don't need the search result but just the displayed collection, you can use the variable you have set with the |
Sorry for some newbie follow-up questions (just so I'm clear). Do I add your above example directly into the smart-table.js file and then add a st-summary directive in my html? Which element do I put the directive on my in my html (the table, the tr that has the ng-repeat)? Does getFilteredCollection get called even if there is no filter on the table? Thank you for the assistance. |
I've been unable to access the filteredCollection, could someone share an example of this working as Lorenzo's directive above? |
Hi @spt131 does this help? http://plnkr.co/edit/kKzrXKbwoMwDP1JMrvQJ?p=preview |
Thanks Jose, that does help. I got it working with this plunker. On Mon, Jul 27, 2015 at 9:46 AM, Jose Gomes notifications@github.com
|
Good stuff |
I'm using a specialized pagination template for my table. Is there a way to get the number of items currently displayed in the table inside of the template? I didn't see any scope variables for it.
The text was updated successfully, but these errors were encountered: