I am trying to create a column in my table using the DataTable plugin, that is calculated using values from two previous columns.
Something like this.. (Price)(QTY)=Total
|| Price || QTY || Total||
==========================
|| 5 || 2 || 10 ||
|| 10 || 3 || 30 ||
|| 4 || 1 || 4 ||
I feel like it should be simple, but I can't get it to work. Here is a similar question I tried to follow.
Here is my JS file where I am initializing the table
var table = $('#tempPOs').DataTable( {
dom: 'frtip', //Bfrtip (removed the B to get rid of the buttons)
ajax: '/inventory/DTResources/php/table.tempPOs.php',
columns: [
{ "data": "pmkPart" },
{ "data": "PartNumber" },
{ "data": "Description" },
{ "data": "fnkManufacturer" },
{ "data": "Notes" },
{ "data": "EachPrice", render: $.fn.dataTable.render.number( ',', '.', 0, '$' ) },
{ "data": "Quantity" },
{ "data": "Username" },
{
data: null,
className: "center",
defaultContent: '<a href="" class="editor_remove">Remove</a>'
}
],
select: true,
lengthChange: false,
buttons: [
{ extend: 'create', editor: editor },
{ extend: 'edit', editor: editor },
{ extend: 'remove', editor: editor }
],
} );
Here is my HTML
<th>Part ID</th>
<th>Part Number</th>
<th>Description</th>
<th>Manufacturer</th>
<th>Notes</th>
<th>Part Price</th>
<th>Quantity</th>
<th>Username</th>
<th>Total Price</th>
<th>Remove</th>
Anyone able to point me in the right direction?