javascript - how to add hidden value in joint JS so that the value can be shown when the element is clicked? -
im confused why doesnt work... first make function:
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; };
then function called in code... adding of parameter value loop
var strname = member(positionx2, 200, 'proyek ' + name + ' (' + datalevel[i].total + ') ', '', '#7c68fd', '#000000', datalevel[i].proyek);
then make value shown on alert code...
paper.on('cell:pointerdown', function (cellview, evt, x, y) { // alert('cell view ' + cellview.model.attr('mycustom') + ' clicked'); } );
mycustom undefined.. if change mycustom: proyek mycustom: 'foo' works.. why happening?
can me.. thanks
Comments
Post a Comment