Keep DataTable but repaginate after repopulating DataTable

Keep DataTable but repaginate after repopulating DataTable

WebDevWebDev Posts: 21Questions: 0Answers: 0
edited November 2012 in DataTables 1.9
Okay, this is at least my third question. I am using the DataTable plugin to great effect on a project I am working on but we need it to do what it does plus several more things. On certain actions we need to keep the DataTable right where it is but empty its data rows (the ones in the TBODY) and put new rows in. Now, this part is actually working but once it plugs in all the new rows it shows *all* of those rows and doesn't then break them into pages. Is there a way to then just call the paginating action?

Replies

  • WebDevWebDev Posts: 21Questions: 0Answers: 0
    Just wondering if anyone has an answer...
  • WebDevWebDev Posts: 21Questions: 0Answers: 0
    edited November 2012
    Here's a live example: http://live.datatables.net/itaven/edit#javascript,html

    It creates the DataTable then empties the TBODY (not sure if I'm doing this part exactly right, I'd like it to end up as , but I think it's right), then adds new rows of content, but doesn't re-paginate after the new rows are added in. Is there a way to then just call the paginating action?

    More current link: http://live.datatables.net/itaven/7/edit
  • WebDevWebDev Posts: 21Questions: 0Answers: 0
    Bump!
  • WebDevWebDev Posts: 21Questions: 0Answers: 0
    Bump!
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    FAQs: http://datatables.net/faqs#append - don't use direct DOM manipulation, but rather use the DataTables API.

    Allan
  • WebDevWebDev Posts: 21Questions: 0Answers: 0
    Okay, I'm trying to figure out which one of these actually repaginates....
  • WebDevWebDev Posts: 21Questions: 0Answers: 0
    Since I can't find a specific "repaginate" feature I've updated my "js bin" to show something else that would work:

    http://live.datatables.net/itaven/10/edit

    Only problem is, when it redraws the table it uses the old data rather than the new data. Is there a way to retain the new data?
  • WebDevWebDev Posts: 21Questions: 0Answers: 0
    Got a decently working version here:

    http://live.datatables.net/itaven/11/edit
  • WebDevWebDev Posts: 21Questions: 0Answers: 0
    Got a decently working version here:

    http://live.datatables.net/itaven/12/edit
This discussion has been closed.