我很困惑为什么这不起作用......首先我做了这个功能:
var member = function (x, y, rank, name, img, background, textColor, proyek) {
textColor = textColor || "#000";
var cell = new joint.shapes.org.Member({
position: { x: x, y: y },
attrs: {
'.card': { fill: "#fff", stroke: background },
image: {},
'.rank': { text: rank, fill: textColor, 'word-spacing': '3px', 'letter-spacing': 0 },
'.name': { text: name, fill: textColor, 'font-size': 11, 'font-family': 'Calibri', 'letter-spacing': 0, 'text-align': 'left' },
mycustom: proyek
}
});
graph.addCell(cell);
return cell;
};
然后在此代码中调用的函数...添加参数值我从循环中获取
var strname = member(positionx2, 200, 'Proyek ' + name + ' (' + dataLevel[i].Total + ') ', '', '#7c68fd', '#000000', dataLevel[i].Proyek);
然后我通过此代码使警告显示的值...
paper.on('cell:pointerdown',
function (cellView, evt, x, y) {
// alert('cell view ' + cellView.model.attr('mycustom') + ' was clicked');
}
);
mycustom总是未定义..但如果我改变mycustom:proyek到mycustom:'foo'它的作品..为什么会发生这种情况?
任何人都可以帮助我..谢谢