cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
883
Views
0
Helpful
3
Replies

attach topology view to DOM element

beasleyjon
Level 1
Level 1

This ought to be very simple but I can't find an example of how its done.

How would I attach a topology view to a DOM element other than the default 'body' element?
Eg - I have a <div> in my page somewhere and I want the topology to appear within that DIV, not attached directly to 'body'.

thanks.

1 Accepted Solution

Accepted Solutions

you can also use this way, this is easier.

var app = new nx.ui.Application();
app.container(document.getElementById('app'));
topo.attach(app);

View solution in original post

3 Replies 3

beasleyjon
Level 1
Level 1

I found the answer to this eventually.

The 'GetContainer' method should be used to attach the application element as a child of a DOM element   -

  var Shell = nx.define(nx.ui.Application, {

                methods: {

                    start: function () {

                        var mv = new com.cisco.MainView();

                        mv.attach(this);

                    },

                    getContainer: function () {

                        return new nx.dom.Element(element);

                    },

                }

            });

you can also use this way, this is easier.

var app = new nx.ui.Application();
app.container(document.getElementById('app'));
topo.attach(app);

thats makes more sense - setting the container property rather than overriding the getcontainer method. I missed that. thanks!