webenginious webenginious - 1 year ago 100
jQuery Question

How to check a jointJS element not based on type but on stencil name instead

I want in Rappid to make a check when inserting an element inside Paper, if this element is Workitem or Activity but the only similar check I found in Rappid documentation is:

if (cell.get('type') !== 'link'){//Do something}

which checks if this element is a link or not. Is there any way to check not based on
but based on
instead(where 'name is one of the Stencil names of basic shapes)?

I mean how will I check if an element is a shape with Stencil name Activity or Workitem?

And where please can I perform this check inside my code since I try so far in the creation of my
to insert a single line of code and I can't.(e.x. I can't even do this
cell.set('wi_name', "ACTIVITY");
to set an inspector field with name wi_name having the name Activity)

Answer Source

I solved my problem this way:

if (cell.get('type') === 'basic.Rect'){}

Where basic.Rect is the basic shape with name either Activity or Workitem as stated in the Stencil.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download