Im trying this:
addChild: function () {
var to = diagram.add(diagram.createShape());
var shapes = diagram.shapes;
var total = shapes.length;
alert("total "+total);
if(total>1){
var toIndex = total-1;
var from;
//obtenemos el shape con el id
var id = diagram.select(diagram.shapes.id);
alert(id);
if(id!=""){
var i=0;
for(i; i < diagram.shapes.length; i++){
if(diagram.shapes[i].id == id){
from = diagram.shapes[i];
break;
}
}
diagram.connect(from, to);
}
}
},
butwhat i get is two shapes, and one is undefined