UNPKG

vso-extension-samples

Version:
56 lines (50 loc) 1.63 kB
<!DOCTYPE html> <html> <head> <title>Contribution context form</title> </head> <body style="background-color:inherit"> <div id="grid-container"></div> <script src="sdk/scripts/VSS.SDK.js"></script> <script type="text/javascript"> VSS.init({ explicitNotifyLoaded: true, usePlatformScripts: true }); var getGridItems = (function() { var nextId = 0; return function _getGridItems(obj) { var items = []; for (var key in obj) { var val = obj[key]; var item = { id: nextId++, values: [key] }; if (val && typeof val === "object") { item.values[1] = "..."; item.children = _getGridItems(val); } else { item.values[1] = JSON.stringify(val); } items.push(item); } return items; }; }()); VSS.require(["VSS/Controls", "VSS/Controls/Grids"], function (Controls, Grids) { var gridItems = getGridItems(VSS.getConfiguration().properties || {}); var gridSource = new Grids.GridHierarchySource(gridItems); var grid = Controls.create(Grids.Grid, $("#grid-container"), { height: "500px", columns: [ { text: "Property key", index: 0, width: 150 }, { text: "Property value", index: 1, width: 600 } ] }); grid.setDataSource(gridSource); VSS.notifyLoadSucceeded(); }); </script> </body> </html>