Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reload Pagination Amounts #172

Closed
jordanmichaelrushing opened this issue Dec 9, 2013 · 2 comments
Closed

Reload Pagination Amounts #172

jordanmichaelrushing opened this issue Dec 9, 2013 · 2 comments
Assignees
Labels

Comments

@jordanmichaelrushing
Copy link

So first off I tried the different options shown in this thread to no avail: #16

My issue is that I have a drop down box with values [20,50,75,100] and an ID of 'per_page_drop'. When I load the page I call:
function tableData() { var e = document.getElementById("per_page_drop"); var value = e.options[e.selectedIndex].value; alert(parseInt(value)); var tabs = document.getElementById("my_table"); tabs.setAttribute('data-page-size',value); }; tableData();
This sends an alert letting me know the default value of the box (I have it defaulting to 20) and sets the data-page-size attribute on my table to the value of the dropdown box. On the initial load no matter what I have the box defaulting to it sets the corresponding rows to that amount. So if I have a default of 50, the rows shown is 50, if its 20 it shows 20.

My issue is that when I change the value in the box the rows do not update. I use onChange() for the dropdown box to reference the tableData() function above. I have also tried to use:
$('.footable').trigger('footable_initialized');
$('table').data('footable').redraw();
$('table').trigger('footable_resize');
$('table').trigger('footable_redraw');

The alert, just like on the load, calls the new amount in the select box. I have an element on my page that shows the milliseconds of GETS POSTS PUTS and UPDATES takes. It is showing 900 milliseconds, meaning it "seems" to be redrawing the table. However, the row amounts do not change from say 20 to 50. Any ideas as to what I'm missing?

Oh also I have tried to wrap the call in ajax like so:

function tableData() { $.ajax({ url : '/', success : function() { var dropdown = document.getElementById("per_page_drop"); var value = dropdown.options[dropdown.selectedIndex].value; alert(parseInt(value)); var params = {"data-page-size":"value"}; var tabs = document.getElementById("my_table"); tabs.setAttribute('data-page-size',value); $('table').data('footable').redraw(); $('table').trigger('footable_resize'); $('table').trigger('footable_redraw'); } }); };

How can I change the data row value and reload the table to show the new amount of rows? Thanks and thanks for amazing plugin!

@jordanmichaelrushing
Copy link
Author

Also, I just checked the Chrome source and I can see the data-page-size attribute change when I select a new value in the drop down box.
So from: data-page-size="20" to data-page-size="50" etc etc

@ghost ghost assigned steveush Dec 13, 2013
@steveush
Copy link
Member

This has been fixed in the Paginate Reinit Fix commit.

Thanks
Steve

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants