Search code examples
angularjssmart-table

Show not the first page on start


I want to show a table from the second page on start. I've used the following to set the second page.

pagination.start = pagination.start || 10;

After this I see the second page and may navigate to other pages, but can't go to the first.

I have created a plunker about the problem.


Solution

  • When You try to load page 1, pagination.start == 0, and 0 || 10 returns 10. If You want to load second page only at start, You can use a flag to indicate, is it first load or not, like this:

    var first = true;
    
    this.callServer = function callServer(tableState) {
    
        ...
    
        pagination.start = first ? 10 : pagination.start;
        first = false;
    

    Forked Your plunkr here