how to set default value of no. of rows per page

how to set default value of no. of rows per page

hiralhiral Posts: 9Questions: 0Answers: 0
edited January 2012 in General
I want to set different values for no. of rows per page for different table. How can I do that?

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    edited January 2012
    http://datatables.net/ref#iDisplayLength :-)

    Allan
  • hiralhiral Posts: 9Questions: 0Answers: 0
    thanks allan. :)
  • hiralhiral Posts: 9Questions: 0Answers: 0
    edited January 2012
    Once we will change no of rows per page means 10 to 25, then can it be remain same in all the tables? Or on other way Can I set the changed no of rows per page variable global for all tables in whole site?
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    You mean set a default? Yes this is possible in 1.9 (currently in beta): http://datatables.net/beta/1.9/examples/advanced_init/defaults.html

    Allan
  • hiralhiral Posts: 9Questions: 0Answers: 0
    I dont get this link.

    My problem is to set no. of rows per page once we set to one table, that would reflect in all tables.

    For example: The default no. of rows per page is 10. So the select box on top of the table Show 10 entries. So if we change it to 10 to 50, then if we access other tables, i could able to see 50 rows in other tables too. I dont need to change everytime in all table's no. of rows per page 10 to 50. So this is one kind of facility which we provide to users. Some user want 10 rows, some like 50 rows etc.

    Is it possible to do this in our tables?
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Ah I see - so the change after the tables have been initialised would effect all other tables.

    Currently there isn't a plug-in method or a plug-in already written to do this, but it is easily possible using the API. There is a plug-in that already does this for filtering, and you could use that as a basis for doing the same thing with length change: http://datatables.net/plug-ins/api#fnFilterAll .

    Allan
  • hiralhiral Posts: 9Questions: 0Answers: 0
    In fnLengthChange() function, how to get the value 100? How to send the value 100 to all other pages so that we can see no of record as 100 in other pages?
This discussion has been closed.