nested table
nested table
Ohunjon
Posts: 9Questions: 5Answers: 0
Hello everybody. I am learning also using this plugin. who can take me any example to use it with custom nested table. how can i to get access to nested table
This discussion has been closed.
Answers
Not sure if you mean child rows, if so, this page may help. If not, please can you provide more details.
thans for answer. but i mean that: I have ready table with data and some rows has nested table with data too. i want here use DataTable and get access to nested table. here is structure almost the same but my data in table ready.
So I've created an application that has nested tables which means that I have a primary table that I'm retrieving using 1 ajax call that is referencing a web service, this web service references a simple stored procedure. This stored procedure returns my "Primary Table" which is loaded within the DataTable. Within the primary function which returns the primary table, there is another function nestedTable that is called, you must declare var table = $('#mydatatable').DataTable(); Then create the event for on('click', function() just as the example displays. But within the format(d) example instead of using hard coded values, you must again use another ajax call to another stored procedure which takes in an input parameter which must be the ID or identity you are using in order to tie the primary and nested tables together. You also need to use a Plus.png, and Minus.png as icons that you can use to toggle between events just like in the sample. If you need a more thorough example let me know, be more than willing to display my code.
@EnterTheBlackDragon - could you share your example with me? I'm trying to create a Nested Table within my primary table, and can't get it working. I have no problems with getting the sample projects working, but I'm unclear how to add the second DataTable() as per your post. The second part of my question is whether or not, I actually need to make multiple ajax calls? I have both the primary Product data and the secondary Stores data available in the same ajax call already. My primary table is based on the Product data and my sub-table will based on Stores that carry that product. Do I need to handle these as two separate ajax calls even though I have the detail I need? Or, is there a better way?
ie. I have:
Product A - Description, etc.
Store 1 - price, url
Store 2 - price, url
Product B
Store 1 - price, url
Store 3
Thank you.
Here is an example of creating a Datatable within the child detail rows:
http://live.datatables.net/gohefoki/1/edit
The key is to derive a
table
id that is different for each child. This example uses the Name column as that is the only unique column in the table.Kevin