cancelar
Mostrar resultados para 
Pesquisar em vez de 
Queria dizer: 
cancel
822
Apresentações
2
Útil
2
Respostas

Not integer id.

npateriy
Cisco Employee
Cisco Employee

Are non integer ids (UUID) supported?

In below sample topologyData1 and topologyData2 works but topologyData3 is failing.

var topologyData1 = {

    nodes: [

        {"id": 0, "x": 410, "y": 100, "name": "12K-1"},

        {"id": 1, "x": 410, "y": 280, "name": "12K-2"}

    ],

    links: [

        {"source": 0, "target": 1},

    ]

};

var topologyData2 = {

    nodes: [

        {"id": "0", "x": 410, "y": 100, "name": "12K-1"},

        {"id": "1", "x": 410, "y": 280, "name": "12K-2"}

    ],

    links: [

        {"source": "0", "target": "1"},      

    ]

};

var topologyData3 = {

    nodes: [

        {"id": "0", "x": 410, "y": 100, "name": "12K-1"},

        {"id": "1a", "x": 410, "y": 280, "name": "12K-2"}

    ],

    links: [

        {"source": "0", "target": "1a"},

      

    ]

};

1 Soluções Aceita

Soluções aceites

nx.graphic.Topology defaults to using the index instead of the id for identifying link source and destinations, you have to set:

identityKey: 'id',

to make it use the ids which then also works with strings.

Ver solução na publicação original

2 RESPOSTAS 2

nx.graphic.Topology defaults to using the index instead of the id for identifying link source and destinations, you have to set:

identityKey: 'id',

to make it use the ids which then also works with strings.

npateriy
Cisco Employee
Cisco Employee

Thanks Alexendar.

For future refernce. This works

var topo = new nx.graphic.Topology({

                    ...

                    identityKey: 'id',

                     .........

                });