Opening all child rows on page load not working with ajax sourced data.

Opening all child rows on page load not working with ajax sourced data.

Ramya.aRamya.a Posts: 3Questions: 1Answers: 0

Hi,

I am trying to keep all the child rows opened on page load. The code worked well with the HTML sourced data but it stopped working when the data was sourced from ajax.

The link for my code is https://jsfiddle.net/Ramya_a/tv64hc0f/4/ .

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,309Questions: 26Answers: 4,947

    Your example seems to be working when clicking the "Expand All" and "Collapse All" buttons. Please let us know how to recreate the issue.

    Kevin

  • Ramya.aRamya.a Posts: 3Questions: 1Answers: 0

    I want all the child rows to be expanded on load.

  • kthorngrenkthorngren Posts: 21,309Questions: 26Answers: 4,947
    Answer ✓

    Sorry, missed the on load part. Since ajax is an async process you need to delay the function that opens all the rows until the Datatable is complete. You can do this in the initComplete option. Like this:
    https://jsfiddle.net/cfobp4gk/

    Kevin

  • Ramya.aRamya.a Posts: 3Questions: 1Answers: 0

    Thank you Kevin it worked! :)

This discussion has been closed.