- Have integrated next topology in Prime UI WAP3.1. Got 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.
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().
Found a way how to do:
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.
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!
Comments
0 comments
Please sign in to leave a comment.