Fluid/Dynamic Table Width

Fluid/Dynamic Table Width

Tom ClarkTom Clark Posts: 7Questions: 0Answers: 0
edited July 2009 in General
I was wondering how to make the table width fluid. I'd like to be able to set a minimum width, and then grow as screen real estate increases. I looked for this functionality in the docs/api, but I couldn't find anything.

Is this possible?

Replies

  • allanallan Posts: 63,578Questions: 1Answers: 10,483 Site admin
    Hi Tom,

    Yes indeed this is possible. What you need to do is disable DataTables' auto column width calculation by using bAutoWidth: http://datatables.net/usage#bAutoWidth

    By default DataTables will calculate optimal width of column based on the information in them in order to stop the column sizes jumping around during paging. As part of this process DataTables applies a fixed pixel width to the table and individual columns. If you set bAutoWidth to false, then these absolute values are not applied and therefore you can us relative values such as 100%.

    Hope this helps,
    Allan
  • Tom ClarkTom Clark Posts: 7Questions: 0Answers: 0
    Oh, yes, my apologies; I found the answer late last night in the forum search (I was searching titles, not comment bodies!), and I forgot to update my question.

    Thanks for the response!

    I see a lot of these types of questions in the forums; perhaps more examples are needed for one-off features like these?
  • allanallan Posts: 63,578Questions: 1Answers: 10,483 Site admin
    Hi Tom,

    Yes - more examples are on my (ever expanding!) to-do list :-). There are a number of new ones in 1.5 which I'll include, and I also plan on constructing an FAQ now that I know what the common questions truly are (rather than just marketing rubbish FAQs...!).

    Regards,
    Allan
This discussion has been closed.