I'm fetching some data through JSON in a container(it is a table), which has previous & next buttons.
In each page, I'm displaying 20 records from the JSON. Now, I need to disable the 'next' button, based on the value of the property 'totalRecords' in the JSON.
So, let say, the value of totalRecords = 238. Which means I should have (238 /20 = 11 pages with 20 records and the last page with 18 records = 12 pages overall). So, how do I ensure that 'next' button is disabled on 12th page in this case? I mean how do I ensure that each time the next button is disabled on the last page based on the similar calculation above?
I tried this :
- if(data.totalRecords%20 > 1) {
- $('#next-btn').addClass('disabled');
- } else {
- $('#next-btn').removeClass('disabled');
- }