2

I am working with jQuery Pagination, and a popup form. On saving the data in the form, how would I go about forcing the Pagination plugin to reload the data it would load for whatever page I am on, without reloading the entire webpage?

Ex: Item 1 Item 2 Item 3

Add Item->Item 23->Save->Reload List

Item 1 Item 2 Item 3 Item 23

http://d-scribe.de/webtools/jquery-pagination/lib/jquery_pagination/README

http://plugins.jquery.com/project/pagination

Brock Adams
  • 90,639
  • 22
  • 233
  • 295
Ben Dauphinee
  • 4,061
  • 8
  • 40
  • 59

2 Answers2

1

The only thing I could think of to do in this situation (and I am not positive it would work) is to call the pagination initialize function again. So you would add the new element, and then call it again like this,

function addNewElement() {
    $.create('div', {}).appendTo("container");
    $("#container").pagination(numElements, {
        items_per_page:20, 
        callback:handlePaginationClick
    });
}

Now, I have never used this plug-in before, but I dont think that there is any other way to "reload" the content since the plug-in does not give you that option. Also, hopefully this overwrites the first call that you made and does not add it onto the first call.

I used the domec plug-in here with the $.create. Just know that is where you create your new element.

Hope this helps!
Metropolis

Metropolis
  • 6,542
  • 19
  • 56
  • 86
0

I looked, but I could not find the source for the plugin. My guess would be you will need to add a 'update' function to the plugin that refreshes the data it is using. Short of that, you will need to unload and reload it.

Dave
  • 2,409
  • 3
  • 22
  • 28