IF inside createdRow not workinging

IF inside createdRow not workinging

AriovaldoAriovaldo Posts: 3Questions: 0Answers: 0
edited February 2020 in Free community support

Hello.

I have a createdRow that works perfectly without an if, but when informed the desired does not happen, could you help me?

Follow code

var table = $('#hidden-table-info').DataTable({bFilter: true,paging: true,destroy: true,data: result.d.data,language: {"emptyTable": "Nenhuma informação encontrada" },columnDefs: [{ className: 'text-center', targets: [0, 1, 2, 3] },],columns: [{ "data": "Documento" },{ "data": "ChapaEmissor" },{ "data": "Status" },{ "data": "Minuta" }],createdRow: function (row, data, dataIndex) {if (data === "37654800"){$(row).addClass('important btn-btn danger');}}});

Thanks!

Replies

  • kthorngrenkthorngren Posts: 21,167Questions: 26Answers: 4,921

    The data parameter in createdRow will be an object containing the whole row. Not sure which column you are interested in but if its the Status column for example you would use something like if (data.Status === "37654800"). See the createdRow docs for examples.

    Kevin

This discussion has been closed.