Ajax table within a table?

Ajax table within a table?

sifuhallsifuhall Posts: 20Questions: 0Answers: 0
edited May 2009 in General
This seems to be a really great addition to jquery and it was very easy to implement.

I'm pulling the data via ajax for a single table, but I have a need to create a dynamic table within a table. Can I display this with datatables?

What I need is (trying to describe as best I can):




Style
Level
Skills




style data here
style level




Skill name
Skill rank




skill name here
skill rank here

Replies

  • allanallan Posts: 61,722Questions: 1Answers: 10,108 Site admin
    Hi sifuhall,

    Thanks for your kind words :-)

    Yes, what you are looking for should be possible with DataTables (although I haven't tested nested tables to the same extent as "normal" ones). What you need to do is initialise your first table and then when that is complete initialise the inner table(s). Let us know how you get on with this - and please do report any odd behaviour.

    Regards,
    Allan
  • sifuhallsifuhall Posts: 20Questions: 0Answers: 0
    Thank you so much for your response.

    After giving it some thought I thought it would be easier to just simulate a nested table and add the data together when pulling it.

    However it seems I have broken it and am unable to find the issue.

    I am using this structure:




    Style
    Rank
    Main
    Skill 1
    Skill 2
    Skill 3
    Skill 4
    Skill 5
    Skill 6
    Skill 7








    and my data is:

    { "aaData": [
    ['Judo','3.00','1','Throw \'em!','Gorilla Grip','Crank the Joint!','Stay Down','Training Warrior','Catlike','Oh No You Don\'t'],
    ['Boxing/Kickboxing','1.00','0','Punching Zip','Make \'em Pay!','Cover Up','Out of the Blue','Iron Chin','Heavy Hitter','Combination King'],
    ['Brazilian Jiu Jitsu','1.00','0','Crazy Legs','Escape Artist','Nimble Fighter','Get Down Here!','Under Pressure','No Way Out','Tap Out or Black Out'],
    ['Muay Thai','1.00','0','Cinch the Clinch','Sprawl and Brawl','Knee Jerk','Greased Lightning','Hardcore Training','Bone Crushing','Four Corner Defense'],
    ['Wrestling','1.00','0','Ground and Pound','Shoot to Kill!','I Prefer to Stand','Tap or Snap','Freedom!','Tough as Nails','Monster Slam']
    ] }


    My result is:
    No matching records found

    but i should have 5.

    If you can spot where I have broken this please let me know.
  • sifuhallsifuhall Posts: 20Questions: 0Answers: 0
    found it.

    i was convinced the issue was in how I was escaping the data and I was son concentrated on this I didn't realize i was initializing an incorrect number of columns.

    Thanks again for such a wonderful tool.
  • allanallan Posts: 61,722Questions: 1Answers: 10,108 Site admin
    Hi,

    Good you hear you got it it sorted :-). I've been meaning to try and find a way to send a warning to the developer from DataTables finds this happening to help debugging - but given the number of data sources DataTables can use, it's actually quite difficult. I'll continue looking at this and hopefully find a way to do it for 1.5 final.

    Regards,
    Allan
This discussion has been closed.