Formatting a Datatable

Formatting a Datatable

JStewartJStewart Posts: 3Questions: 0Answers: 0
edited November 2013 in General
Hello! I am new to DataTables as in this is the first time I have ever looked at the API at all. I am trying to build a dynamic table that is populated using a JavaScript array that I build from a backend data response. I am also using the response to build a columns array to feed to the datatable as well.

This table will serve as the payload of a widget. Yes I am aware that the table will be small but I need to do this none the less. I wil provide a method to blow the widget up to make the table more useful but that is another topic. My concern is that I am having a very difficult time controlling the height and width of the data table.

Note I am creating all of this dynamically, even the table element does not exist on the page until the user chooses to create a table widget. So to my actual question, how do I control the height and width of my datatable?

A full code example can be seen at this fiddle: http://jsfiddle.net/2ccgk/5/

I need that table to fit in to the widget which is outlined in black...any advice?

Replies

  • JStewartJStewart Posts: 3Questions: 0Answers: 0
    No one has any tips for this?
  • jsmith88jsmith88 Posts: 10Questions: 0Answers: 0
    edited December 2013
    Use a smaller font? Use abbreviated strings for column/header values? Add "overflow: scroll" to the black outline DIV (http://jsfiddle.net/2ccgk/6/)? If you are trying to render it in such a small box you don't really have a lot of choices...
  • JStewartJStewart Posts: 3Questions: 0Answers: 0
    Thank you that is what I figured but as I said being so new, I was unsure of all the possibilities.
This discussion has been closed.