Adding ajax to child rows

Adding ajax to child rows

WilkesyWilkesy Posts: 4Questions: 2Answers: 0

Hi,

Hopefully very simple problem. In my old intranet system (8 years ago) that I have set up, there was a way of initiating nested tables for each table row. I had this setup to pull in an ajax request to load up a multi-row table of live data based on sending through a single unique value for each row. I have now updated everything including all of the datatables scripts while building an up-to-date intranet and i can no longer see how this work.

I have tried the 'Child Rows' script but struggling to get a value passed in and to get an ajax script loaded on click, and I've also tried a subtable option that I found but again can't get this to recognise the unique value passed in.

Does anyone have a setup that they could show me so that I can get this up and running again, please?

Appreciate all your help

Paul

Answers

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin

    Hi Paul,

    Its very difficult to say what might be going wrong without being able to see it unfortunately. However, I can point you at this blog post which describes a method for loading child row data via Ajax. perhaps that will help?

    Allan

  • WilkesyWilkesy Posts: 4Questions: 2Answers: 0

    HI Allan,

    Many thanks for the above information, its a great start and im almost there!

    What I am trying to do is display a full list of all purchase orders on the initial table when the report loads. I then need to be able to expand out and show all of the lines on the PO in the child rows section. I'm struggling to be able to get these child rows to output as a table. I've tried getting all the lines from the database and returning them as a JSON array but cant then get a 2nd table to load. I've also tried building the table in the ajax php file and returning the whole thing but that doesn't seem to load either.

    Can i call on your wisdom again to help, please?

    Appreciate your help

    Paul

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin

    Hi Paul,

    Is the example shown here basically what you are looking for? It is editable in that case, which you might not want, but the editing controls on the child table can readily be dropped.

    Allan

Sign In or Register to comment.