Search code examples
jointjs

JointJS - Using 'when:' in Inspector inside list


I'm building an Inspector dynamically based in a JSON. However, I can't get when: working. Imagine that: I'm inside a list of object's called list, and I got three objects: type, rule and script.

  • type is a select-box, which values rule or script.
  • rule is a text
  • script is a text-multiline (custom type)

I need to show rule only if type is equals to rule, and show script only if type is equals to script. How can I do that? I tried to add to to rule the following when::

when: {eq: {"type": "rule"}},

And a similar one to script:

when: {eq: {"type": "script"}},

However, the Inspector seems to ignore that, and never show them, nor rule, nor script. How can I make that condition work properly?


Solution

  • JointJS inspector is very limited, and was only giving me problems. I've replaced it with a custom made inspector, made with AngularJS, HTML5 and SASS. In case anyone is having the same trouble, that's my advice: it's much easier to create an inspector from scratch than trying to use JointJS's inspector.