datatable json

PHOTO EMBED

Sun Jul 23 2023 08:58:36 GMT+0000 (Coordinated Universal Time)

Saved by @nelson22

<table id="focusedProduct1" class="display">
    <thead>
        <tr>
            <th>Material Code</th>
            <th>Material Description</th>
            <th>UOM</th>
            <th>Status</th>
        </tr>
    </thead>
    <tbody>
    </tbody>
</table>


var data1 = 
	  [
	    {
	      "id": "1",
	      "materialCode": "200000159",
	      "materialDesc": "DEEP GROOVE BALL BEARING-6202 ZZC3",
	      "uom": "MT",
	      "status": "<span class='red-dot'></span> Red or Black"
	    },
	    {
		  "id": "2",
		  "materialCode": "200002039",
		  "materialDesc": "THERMOCOUPLE,QRT/K,3MM,1000MM",
		  "uom": "EA",
		  "status": "<span class='red-dot'></span> Red or Black"
		}
	  ]
	
	
	$('#focusedProduct1').DataTable({
	    "data": data1,
	    columns: [
	        { data: 'materialCode' },
	        { data: 'materialDesc' },
	        { data: 'uom' },
	        { data: 'status' },
            {
                "data": null,
                sortable: false,
                render: function (data, type, row) {
                    return btn = `<a class="table-btn" href="${data.filepath}">Download</button>`;
                }
            },
	    ],
	});
content_copyCOPY