paper.on('cell:pointerdown',
function(cellView, evt, x, y) {
for(var i=0; i<menu.length;i++){
if(menu[i].id===cellView.model.id){
graph.addCell(menu[i].clone());
}
}
}
);
In this code, I clone an element from an array of elements menu. I expected the clone to have a unique id
because the clone function was supposed to give a new id
, but it has the same id
as the cloned element .
Can someone explain me why does it happens and how to properly clone elements?