Make variable column numbers work

Make variable column numbers work

tristanvanbokkemtristanvanbokkem Posts: 19Questions: 0Answers: 0
edited February 2013 in General
Hi Allan,

I have been trying to implement DT the last couple of days. All seems to work at this point quite nicely except I have no idea on how to make DT work with variale column numbers. I have dug into the forums already but couldn't find a clear answer.

I know my JSON will return 19 keys in the array so I have to set the HTML to have 19 tags. But what if my JSON will return 20 keys? At this point it will brake my DT.

Replies

  • ITARulezITARulez Posts: 10Questions: 0Answers: 0
    i have similar problem....
  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    If your HTML is on the page, then you need to modify the number of columns in the HTML. This can be done using jQuery / DOM to add / remove elements as you need, or alter the HTML that is output by your script.

    Alternatively, use DataTables to create the columns (unless you are using Ajax sourced data, in which case you need to make the Ajax call yourself) using sTitle to set the column title.

    Allan
  • tristanvanbokkemtristanvanbokkem Posts: 19Questions: 0Answers: 0
    I am using ajax sourced data. What do you suppose with making the Ajax call yourself?
This discussion has been closed.