DataTables in jQuery UI Widgets

DataTables in jQuery UI Widgets

thaneshkadithaneshkadi Posts: 5Questions: 0Answers: 0
edited December 2009 in General
Hi

I got a quick question. Can we use DataTables in jQuery UI Widgets like Accordion. If so can please help in this.

I am dynamically generating a table which need to be placed in the Accordion widget with full pagination using datatables.

When i tried this i am getting an error like this

aLayout[0] is undefined
[Break on this error] for ( i=0, iLen=aLayout[0].length ; i

Replies

  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    Hi Kumar,

    Yes indeed you can put DataTables anywhere on a page, including a jQuery UI widget.

    The error you are getting there is typically caused by an issue with the table header. Do you have thead defined and a unique TH element for each column? If not, then I'd suggest modifying that. If you do, then perhaps you could post a link showing the problem please?

    Regards,
    Allan
  • shamelessshameless Posts: 31Questions: 0Answers: 0
    Alan,

    It's been a while, but I'm back to playing with datatables.

    My table header is disappearing. The height is set to 0px only when I wrap datatables with an accordion. is explicitly defined; 's exist. What does "unique TH element for each column?" mean in your suggestion above?

    You can see the problem here under the "Current Issues" accordion segment:

    http://esc.toypizza.com/index.php/sysalert

    regards,

    Shameless
  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    You need to call fnAdjustColumnSizing() ( $('#sysalerts').dataTable().fnAdjustColumnSizing(); ) once the table is made visible, as shown in this example: http://datatables.net/examples/api/tabs_and_scrolling.html

    It's worth starting a new thread for questions like this rather than pulling up one from well of a year ago btw :-)

    Allan
  • shamelessshameless Posts: 31Questions: 0Answers: 0
    I forgot to do this after the table was visible. Thanks, Alan!
This discussion has been closed.