Adding a dropdown row to an existing row

Adding a dropdown row to an existing row

klynnklynn Posts: 2Questions: 0Answers: 0
edited October 2012 in General
Hello,
So I've been using fnAddData to add all of my data to my table. This has been working great so far but now I want to make it so that one column has a link saying "Click for more info" when thats clicked I want the row to expand and just show a couple of lines of text... Ive been trying to use fnAddData with an array of arrays to add the multiple rows at once but they arent being linked together like I want (the expanded row of data is being thrown at the bottom of the table, not with the row that was clicked and this is because the table is being sorted alphabetically based on the first column). Is there a way to insert just one row at a time so that when the button is clicked is just throws in the new row below the one that is being clicked on?? Or add just one row but have it span over multiple lines that I can hide and show using CSS?? Please let me know the best solution to accomplish this or if its not possible...
Thanks

Replies

  • klynnklynn Posts: 2Questions: 0Answers: 0
    edited October 2012
    I found this in the API and this is almost exactly what I need.
    http://datatables.net/examples/api/row_details.html

    My only question is is it possible to keeping using fnAddData to continue adding my data to the table
    This code is in a huge forreach loop at loops through over 1000 records and adds the data to the appropriate table. (NewWork is one of 6 in a switch block)

    [code]
    $('#NewWork').dataTable().fnAddData( [
    theData+ businessUnit,
    theData+ shortName,
    theData+ jobNumber,
    theData+ projectManager,
    theData+ finalDueDate,
    theData+ filePath ]
    );
    [/code]

    This is how I am adding a new row to my tables but I also need to bump them over for the cell where the expand image goes. Now I have it able to bump over but then all of the columns get out of line... for example the widths are all offset by one and same with the sorting... When i try and offset them in the aoColumnsDef I keep getting the requested unknown parameter error. How can I fix this?
This discussion has been closed.