Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make buttons to skip on first and last page in smart table for AngularJS

I am using smart table for angularJS, how can I add buttons to jump on first and last page?

like image 283
Zvonimir Tokic Avatar asked Nov 28 '25 01:11

Zvonimir Tokic


1 Answers

There are already quite few github issues talking about the matter, you should simply specify your custom template:

  1. By overriding the template in the $templateCache
  2. Or by specifying a custom url for your template.

Template could be

<div class="pagination" ng-if="pages.length >= 2">
   <ul class="pagination">
   <li ng-if="currentPage > 1">
     <a ng-click="selectPage(1)">&lt;&lt;</a>
   </li>
   <li ng-if="currentPage > 1">
     <a ng-click="selectPage(currentPage-1)">&lt;</a>
   </li>
   <li ng-repeat="page in pages" ng-class="{active: page==currentPage}"><a ng-click="selectPage(page)">{{page}}</a>
   </li>
   <li ng-if="currentPage < numPages">
      <a ng-click="selectPage(currentPage+1)">></a>
   </li>
   <li ng-if="currentPage < numPages">
     <a ng-click="selectPage(numPages)">>></a>
   </li>
  </ul>
</div>

running example

like image 166
laurent Avatar answered Nov 30 '25 17:11

laurent



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!