Master detail inside column
Master detail inside column
Hello everyone, I was trying to create a table inside the column as a master detail, but I was not able to, I noticed several posts, but I did not reach any conclusion, so finally I got the expected result, I will stop contributing to others that have the same result.
Here is the code snippet below:
Format array = {"cod_transacao":"1","itens_transacao":[{"cod_item":"1"},{"cod_item":"2"}]}
Version Datatables = 1.10.5
{"mData": null,
mRender: function (data, type, obj) {
var tabela = "<table class='table tabletable-striped table-bordered'>" +
"<thead>" +
"<tr style='background-color: #F5EADB'>" +
"<th data-hide=''>Item</th>" +
"<th data-hide='phone,tablet'>Descrição</th>" +
"<th data-hide='phone,tablet'>Valor</th>" +
"</tr>" +
"</thead>" +
"<tbody>";
var td = "";
$.each(obj.transacao_item, function (index, item) {
td += "<tr><td>" + item.item_nome + "</td>";
td += "<td>" + item.item_descricao + "</td>";
td += "<td>" + item.item_valor + "</td></tr>";
});
tabela += td + "</tbody></table>";
return tabela;
}
}
Accept new ideas, thank