3

In angular app, I have used ng2-smart-table. And I have enable pagination in that. But it shows normal look. Instead of that default look, I have used dropdown with page option.

<select>
  <option>5</option>
  <option>10</option>   
  <option>15</option>
</select>

I have set change event also.

Issues:

1) How can I update ng2-smart-table to set page size as per value change.

2) I want to also move on specific page. E.x: Table has 1000 data and per pager there are 10 records. So I want to just on page of 14. So, how can I do that?

For that, I have refer it's documentation but I didn't get any event for that.

1 Answer 1

5

To update perpage value.

this.DataSource.getPaging().perPage = event.target.value;

And to set a specific page you have to use setPage().

this.DataSource.setPage(3); // Pass page number

It works fine for me. for details example please see this link.

3
  • DataSource.setPaging() worked for me. setPage() did not work for me.
    – blogs4t
    Apr 25, 2019 at 19:44
  • @blogs4t I don't know why ? I think you might be doing in diffrent way. But for me it always works. Apr 26, 2019 at 4:30
  • setPaging() is for number of rows per page and setPage() is for current page-> this is mostly used for pagination if you directly jump to specific page. May 22, 2019 at 7:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.