cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements

883
Views
0
Helpful
4
Replies
ssamel
Beginner

Need to remember node placement

Hi,

We have integrated next topology in Prime UI WAP3.1.

We have a requirement where, we can remember the placement of icons displayed even if we move from one page to another.

For now, we are calling API which returns us the x,y co-ordinates of the icons and this API gets called each time we visit the page. So it displays the icons at pre-defined positions.

Do we have any solution to remember the position of icons?

Thanks,

Sachin

4 REPLIES 4
aaikepae
Cisco Employee

Hi Sachin,

You can call topo.getData() get the all data from topology and try to save back-end or localstorage. next you visit you can loadd that that and call topo.setData().

Abu

hy Abu

It's sounds easy... but I didn't get it. Can you show us an example?

thanks

Thiago

Hi,

I found a way how to do (maybe not the best, but it works for me):

1) declare variable "node"  your nx.ui.Application as global:

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

        methods: {

            start: function() {

                node = new MyName.Node();

                node.attach(this);

            }

        }

    });

2) In your class extending nx.ui.Component define a methode getTopo:

methods: {

            attach: function(args) {

                this.inherited(args);

                this.model(mainModel);

            },

            getTopo: function() {

                var i = this._resources.topo;

                return i;

            }

        }

3) define javascript function called from save button:

<script>

  function showData(){

  var node = window.node;

  var topo = node.getTopo();

  var result = topo.getData();

.....

  </script>

Result now holds TopologyData Object.

hope that helps

Markus

mizhu2
Cisco Employee

Usually  we do this at back end, the topology model already have coordinate properties, if you can save this in database with back end service, then fill it back for topology model it will show memorized topology without problem!

Create
Recognize Your Peers
Content for Community-Ad