DataTable wont shot row from ajax sourced data

DataTable wont shot row from ajax sourced data

sjw01sjw01 Posts: 67Questions: 36Answers: 1
edited December 2019 in Free community support

I have created a fiddle: http://live.datatables.net/xopuciga/1/edit

When I set this up, I had it working fine (returning the text 'TABLE')
(I am using ajax sourced data for the table in my live app but have changed it to a Javascript array in the fiddle to get a working)

I have added the ajax sourced child table via a callBack to formatTable but I keep getting an error.

I restored the ajax success call to call a function within the ajax call (instead of using the callBack) and the error still persists.

"TypeError: Cannot read property 'show' of undefined

It is telling me that the row I created is undefined now ... I don't understand what has changed.

I based this of the example here: https://datatables.net/examples/api/row_details.html

Answers

  • kthorngrenkthorngren Posts: 20,294Questions: 26Answers: 4,768

    First you had quotes around the dataSet array making it a string. Removing the quotes makes dataSet an array and the data populates. Ajax is an async process so the show() is executed before the ajax request completes. The Ajax loaded detail rows blog details how to do what you want.

    Kevin

This discussion has been closed.