From e23419ce15e7b947789de8a705162f354c884b9f Mon Sep 17 00:00:00 2001 From: Danny Engelman Date: Thu, 18 May 2017 13:26:51 +0200 Subject: [PATCH] Restructered renderData function to human readable compact version --- .../latestOrders/LatestOrdersWebPart.ts | 42 +++++++++---------- 1 file changed, 19 insertions(+), 23 deletions(-) diff --git a/samples/aad-api-spo-cookie/src/webparts/latestOrders/LatestOrdersWebPart.ts b/samples/aad-api-spo-cookie/src/webparts/latestOrders/LatestOrdersWebPart.ts index eec3c1a6f..929923bea 100644 --- a/samples/aad-api-spo-cookie/src/webparts/latestOrders/LatestOrdersWebPart.ts +++ b/samples/aad-api-spo-cookie/src/webparts/latestOrders/LatestOrdersWebPart.ts @@ -71,31 +71,27 @@ export default class LatestOrdersWebPart extends BaseClientSideWebPart + ` + ${order.id} + ${new Date(order.orderDate).toLocaleDateString()} + ${order.region.toString()} + ${order.rep} + ${order.item} + ${order.units} + $${order.unitCost.toFixed(2)} + $${order.total.toFixed(2)} + ` + ).join(''); + } } - let ordersString: string = ""; - this.orders.forEach(order => { - ordersString += ` - - ${order.id} - ${new Date(order.orderDate).toLocaleDateString()} - ${order.region.toString()} - ${order.rep} - ${order.item} - ${order.units} - $${order.unitCost.toFixed(2)} - $${order.total.toFixed(2)} -`; - }); - - const table: Element = this.domElement.querySelector(".data"); - table.removeAttribute("style"); - table.querySelector("tbody").innerHTML = ordersString; - } - private executeOrDelayUntilRemotePartyLoaded(func: Function): void { if (this.remotePartyLoaded) { func();