/*let table = new Tabulator("#shopping_cart_table", { layout:"fitColumns", columns:[ {title:"Produkte", field:"col1", headerSort:false}, {title:"zusammen mit", field:"col2", headerSort:false}, ], }); function updateShoppingCartTable(id) { if (typeof id !== 'undefined') { request('shopping_cart', id).then(function () { table.setData("/bauDas/shopping_cart?id="+id); }); } else request('shopping_cart').then(function () { table.setData(); }); }*/ let shopping_cart_result; function updateShoppingCartTable(id) { if(typeof id !== 'undefined') { request('shopping_cart', id).then(function (data) { shopping_cart_result = data; drawShoppingCartTable(); }); }else request('shopping_cart_result').then(function(data) { shopping_cart_result = data; drawShoppingCartTable(); }); } function drawShoppingCartTable(){ let table = document.getElementById("shopping_cart_table"); while(table.hasChildNodes()){ table.removeChild(table.firstChild); } let row = $(""); row.append(""); row.append("Artikel"); row.append("Wird häufig zusammen gekauft mit") row.append(""); row.append(""); row.append(""); for (x in shopping_cart_result){ row.append(""); row.append("" + shopping_cart_result[x].col1 + ""); row.append("" + shopping_cart_result[x].col2 + ""); row.append(""); } row.append(""); $("#shopping_cart_table").append(row); }