Other supported data types for expanding a row?

Other supported data types for expanding a row?

rbeckrbeck Posts: 1Questions: 1Answers: 0
edited March 2023 in Free community support

I am currently using a this guide to get HTML escaped in a JSON string when a row is expanded, eg

function format ( rowData ) {
    var div = $('<div/>')
        .addClass( 'loading' )
        .text( 'Loading...' );
 
    $.ajax( {
        url: '/api/staff/details',
        data: {
            name: rowData.name
        },
        dataType: 'json',
        success: function ( json ) {
            div
                .html( json.html )
                .removeClass( 'loading' );
        }
    } );
    return div; }

What other types of data are supported? Can I have the URL return the HTML directly instead of being in JSON? If not, can the JSON be Base64 encoded?

Answers

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin
    edited March 2023

    You are making your own Ajax call there, so you can support any data type you want. In your success function you would just transform whatever is returned into JSON. For example you could have the server return HTML, Markdown, or YAML, or whatever else - turn it into HTML and using div.html(...) to put it into the page.

    Allan

Sign In or Register to comment.