Below I attached my table.
I want to create a datatable with two columns price and schedule_from if TYPE=='retail'.
this is my code.
$('#retail-price-history').DataTable({
data: record.retail_history,
destroy: true,
searching: false,
ordering: false,
dom: '<<"row"<"col">>t<"row"<"col">>>',
columns: [
{
data: "price",
"render": function ( data, type, full, meta ) {
return data/100;
}
},
{ data: "scheduled_from"
}]
});
This is my json record.retail_history
{[
TYPE: "retail"
id: 6069714
price: 899
scheduled_from: "2022-01-20"
sku: 1435530
]
[
TYPE: "cost"
id: 123
price: 599
scheduled_from: "2022-11-01"
sku: 1435530
]}
how to populate data on my data table if the condition satisfy TYPE =='retail'. Now According to my code its populating all data either TYPE is 'retail' or 'cost'