Need to create a table based on JavaScript array.

Need to create a table based on JavaScript array.

simkessysimkessy Posts: 4Questions: 1Answers: 0
edited October 2013 in General
I need to recreate this http://i.imgur.com/53hfvd6.png using DataTables.

Using Javascript, I can get all groups, all users and all users within each group. Using DataTables is it possible to create what I have in the image? I need a way to automatically track which groups users belong to and I think DataTables can really help, I'm just not sure how to do it yet. Any help would be appreciated.

Also, I noticed that the html structure of the table needs to be created first and the plugin doesn't create the table automatically? Is there any way around that?

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    I'd say the first thing to do is get the data in to either a plain HTML table. Or into a JavaScript array of objects, with each object being a row. The you ca use DataTables on the data (post back with what you've got!).

    Regarding creating a table - DataTables will do that for you:
    http://datatables.net/release-datatables/examples/data_sources/js_array.html

    Allan
This discussion has been closed.