lorenzofox3 / Smart-Table

Code source of Smart Table module: a table/grid for Angularjs
http://lorenzofox3.github.io/smart-table-website/
1.8k stars 513 forks source link

stPagination with client side code not working #778

Closed mathangiK closed 7 years ago

mathangiK commented 7 years ago

Smart Table Version: 2.1.2 AngularJS Version: 1.5.0

Most popular answers for this include setting st-safe-src and injecting smart-table to the app. Since I am asynchronously receiving the information I have set the st-safe-src and the st-table respectively. I tried extending the directive without much success. The issue can be seen in the below example. I am looking to implement a pagination logic for my data-set.

http://plnkr.co/edit/yfQtVgJzJr7pYFxvufYf?p=preview

MrWook commented 7 years ago

Hello @mathangiK,

Try to increase the items and you will see the pagination. If you open the debug console and look into the element where the pagination should be you can see a comment for "ng-if" that the pagination is hidden till atleast 2 pages

I think the problem that you encounter is, that you try to set the items by page to 5 and you got 8 items so you should have 2 pages. It seems like the directive to set the items by page don't work properbly in 2.1.2 so i suggest that you upgrade it to the newest Version and it will work

mathangiK commented 7 years ago

Viola, it works, thank you very much.

qmy777 commented 7 years ago

@MrWook How can i do something to show the pagination when the number of page just have only one page? Only to change the source code?

MrWook commented 7 years ago

Hello @qmy777,

you can use a custom template like in the documentation explained, under 'Global configuration':

angular.module('myModule', []).config(function(stConfig) {
  stConfig.pagination.template = 'my-custom-pagination-tmpl.html';
});

A example for the custom pagination is at the end of the documentation