Child row data not showing.

Child row data not showing.

tekuilatekuila Posts: 24Questions: 5Answers: 0

Hello

Here's the code for the child rows:

function format ( rowData ) {
    var div = $('<div/>')
        .addClass( 'loading' )
        .text( 'Loading...' );

    $.ajax( {
        url: '/kurs',
        data: {
            kursnavn: rowData.courses.course_name.name
        },
        dataType: 'json',
        success: function ( json ) {
            div
                .html( json.html )
                .removeClass( 'loading' );
        }
    } );

    return div;
}

JSON data is displayed and loaded fine on the table rows.
See JSON data here: larosvomme.herokuapp.com/kurs.json

But how to display the data in the child rows? How to add the data correctly here? I tried many many possible combinations in the below line, but the child row keep saying "Loading...":
data: {
kursnavn: rowData.courses.course_name.name
},

Thank you
- Jonas

Answers

  • colincolin Posts: 15,237Questions: 1Answers: 2,598

    Hi @tekuila ,

    It looks like you're just removing the class loading, but the text isn't being changed, nor are you doing anything with the response to the ajax data. As shown in the example here, you have to create something to be shown in the child row.

    If that doesn't help, we're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

This discussion has been closed.