ChildRows of related Tabel
ChildRows of related Tabel
Hello everybody
I've followed this example: https://datatables.net/examples/api/row_details.html.
I've used it in my MVC5 ASP .NET App With EntiyFrameWork DataBase first and it worked fine
Except for one thing.
My problem is, how do I fill the child rows with the related data to my main table.
The example just fills child row with data from one table.
I need the child rows to be exactly that - a result of the parent table.
So when I have a 1-* (1 Service - many ServiceTexts). I get all the data just fine when I Query the model.
But the table
function format(d) {
// `d` is the original data object for the row
return '<table cellpadding="5" cellspacing="0" border="1" style="padding-left:50px;">' +
'<tr>' +
'<td>Dags dato:</td>' +
'<td>' + d.Dagsdato + '</td>' +
'<td>Udført af:</td>' +
'<td>' + d.udføresaf + '</td>' +
'<td>Tid:</td>' +
'<td>' + d.Tid + '</td>' +
'<td>Tidsforbrug:</td>' +
'<td>' + d.Tidsforbrug + '</td>' +
'<td>Part SN:</td>' +
'<td>' + d.itemID + '</td>' +
'<td>Text:</td>' +
'<td>' + d.Text + '</td>' +
'<td>ServiceID:</td>' +
'<td>' + d.ServiceID + '</td>' +
'</tr>'
'</table>';
}
returns Undefined. I don't understand how the table would know what d is and if i only have to replace d with something
for this to work.
Can anyone help? This is driving me crazy.
Answers
EDIT:
I think the problem lies here somewhere in the lower part where:
// Add event listener for opening and closing details.
Seems like this is not beeing used or returning nothing.
The Ajax option url:home/GetService works fine for the DataTable.
So i states this for the GET pat of the small table aswell.
Is this wrong?