Change the number of displayed rows externally (api?)

Change the number of displayed rows externally (api?)

pmalvespmalves Posts: 18Questions: 0Answers: 0
edited September 2009 in General
Hey.


My users would like to see a button of "load 10 more" that would expand the datatable. What's the best way to do it? I see there's no function for it; Should I change the settings with fnSettings and do a fnDraw? Or is there an easier way?


Thanks

-Pedro

Replies

  • allanallan Posts: 61,833Questions: 1Answers: 10,133 Site admin
    Hi Pedro,

    I'd go with fnAddData(). If a user wants to load 10 more rows, then they would click that button, and you would use fnAddData() to add the ten new rows from whatever your data source is.

    Allan
  • pmalvespmalves Posts: 18Questions: 0Answers: 0
    Oh, on this case the data is already there, just hidden (I know, I know..)
  • allanallan Posts: 61,833Questions: 1Answers: 10,133 Site admin
    Sorry - might be misunderstanding here... Does this mean it answers what you are looking for. Or do you want a method of going to the 'next' page?

    If you want to page to the next page you can do something like "$('#{TABLE_ID}_next').click();"

    Allan
  • pmalvespmalves Posts: 18Questions: 0Answers: 0
    I didn't explain myself.


    I load a table with 100 entries that I limit to 10 and I disable pagination.

    The user wants to increase the number of displayed items with a "show 10 more" style. I have the data in the dom, I just want to display it, increasing the size of the table like the dropdown does (except this case there's no drop down)
  • allanallan Posts: 61,833Questions: 1Answers: 10,133 Site admin
    Ah got it. Check out this thread (from a quick search on the forum): http://datatables.net/forums/comments.php?DiscussionID=542

    Allan
This discussion has been closed.