Child rows without an additional ajax call

Child rows without an additional ajax call

JohnCannon.ITJohnCannon.IT Posts: 8Questions: 4Answers: 0

I'm trying to use the child rows example you have, but without an ajax call, as I already have all the data with an MVC Viewmodal being passed:

$(document).ready(function() {
var table = $('#example').DataTable( {
"ajax": "../ajax/data/objects.txt",
"columns": [
{
"className": 'details-control',
"orderable": false,
"data": null,
"defaultContent": ''
},
{ "data": "name" },
{ "data": "position" },
{ "data": "office" },
{ "data": "salary" }
],
"order": [[1, 'asc']]
} );

Instead of the ajax call, can I pass the Viewmodel into the DataTable, and the additional javascript from your example should hide and show it as necessary?

  • John

Replies

  • JohnCannon.ITJohnCannon.IT Posts: 8Questions: 4Answers: 0

    Should I load everything into a table but hide the rows that I want to be in the child rows, in order to get the data to the datatable javascript without an additional ajax call?

  • catonalakecatonalake Posts: 3Questions: 0Answers: 1

    i think all you need to do classe="none" on the header col that you want to have shown as a child :)

This discussion has been closed.