UNPKG

gojs

Version:

Interactive diagrams, charts, and graphs, such as trees, flowcharts, orgcharts, UML, BPMN, or business diagrams

46 lines (45 loc) 2.17 kB
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Table Layout</title> <meta name="description" content="TypeScript: Use the TableLayout extension to arrange nodes in a tabular or grid-like form." /> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- Copyright 1998-2020 by Northwoods Software Corporation. --> <script src="../samples/assets/require.js"></script> <script src="../assets/js/goSamples.js"></script> <!-- this is only for the GoJS Samples framework --> <script id="code"> function init() { require(["TableScript"], function(app) { app.init(); }); } </script> </head> <body onload="init()"> <div id="sample"> <div style="width: 100%; display: flex; justify-content: space-between"> <div id="myPaletteDiv" style="width: 120px; height: 600px; margin-right: 2px; border: solid 1px black"></div> <div id="myDiagramDiv" style="flex-grow: 1; height: 600px; border: solid 1px black"></div> </div> <p> This sample demonstrates a custom Layout, TableLayout, that is very much like a simplified "Table" Panel layout, but working on non-Link Parts in a Diagram or a Group rather than on GraphObjects in a Panel. The layout is defined in its own file, as <a href="TableLayout.ts">TableLayout.ts</a>. </p> <p> You can drag-and-drop nodes from the Palette into any Group. Dragging into a Group highlights the Group. Drops must occur inside Groups; otherwise the action is cancelled. </p> <p> Each row and each column is <a>Part.resizable</a> and has a custom <a>Part.resizeAdornmentTemplate</a> showing a single resize handle on the right side or on the bottom. There is a custom LaneResizingTool to provide a minimum width or height based on the contents of all of the groups (cells) in that column or row. </p> <p> This example assumes the Groups are predefined and exist in each cell at a particular row/column, but this sample could be extended to allow adding and removing rows and/or columns. </p> </div> </body> </html>