How do I change initialisation parameters at runtime?

How do I change initialisation parameters at runtime?

BelisariusBelisarius Posts: 26Questions: 0Answers: 0
edited March 2009 in General
Hi,

Apologies if this is obvious, but having initialised a table, how can I change parameters like bPagination so that I can turn pagination on and off and redraw the table as appropriate?

Cheers

Andy

Replies

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin
    Hi Andy,

    Have you had a look at the usage examples? For each configuration I've put a code example of how it can be used (click the 'Show details' link for that parameter. For example: http://datatables.net/usage . Also have a look at the basic initialisation examples from the top of that page.

    Allan
  • BelisariusBelisarius Posts: 26Questions: 0Answers: 0
    Sorry, I thought that those options were applicable when you first initialise the table on form ready. I want to change those options once the table is loaded i.e click a button to switch between paged and non-paged view?

    Andy
  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin
    Hi Andy,

    Sorry, I misunderstood your intention. DataTables doesn't currently support feature switching after initialisation.

    What you could do is give the appearance of enabling and disabling feature though. In the pagination example you could simply set the display length to be very long and the paging element to be display:none; to "disable paging". Then to re-enable show the paging element and set the length back to what it was. This kind of action could be done as a custom API plug-in.

    Hope this helps,
    Allan
This discussion has been closed.