Other supported data types for expanding a row?
Other supported data types for expanding a row?
rbeck
Posts: 1Questions: 1Answers: 0
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
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 usingdiv.html(...)
to put it into the page.Allan