javascriptmxgraphjgraphdraw.io

How to create multiple tabs or sheets or pages in mxGraph?


Draw.io has the feature of multiple pages with a tab view in the bottom.

But to integrate that into mxgraph graph editor, it seems like an overkill.

I'm looking for a simpler solution or some sort of workaround.


Solution

  • for sort of workaround I have solution. Creates the graph inside the given container using a model with a custom root and two layers. Layers can also be added dynamically using const layer = model.add(root, new mxCell()).

    const root = new mxCell();
    const  layer0 = root.insert(new mxCell());
    const layer1 = root.insert(new mxCell()); 
    const model = new mxGraphModel(root);
    

    Just look example