Event ContextPad Element

Hello,

I want to achieve that when I click on an element in the ContextPad that an action is triggered. I already looked into the bpmn-js examples so I implemented a CustomContextPad and defined the following code.

if ((element.type === 'bpmn:SubProcess')){
        return{
            'append.outer-rect': {
                group: 'model',
                className: 'bpmn-icon-check-empty',
                title: translate('Append outer rect'),
                action: {
                    click: appendOuterRect(20)
                }
            }
        };
    } 

It actually works fine but the click is triggered when I click on the element and also when I click on the element in the contextpad. How can I achieve that the appendOuterRect function is only executed when I click on the contextpad element?

Thanks in advance!

I found an easy solution:

if ((element.type === 'bpmn:SubProcess')){
        return{
            'append.outer-rect': {
                group: 'model',
                className: 'bpmn-icon-check-empty',
                title: translate('Append outer rect'),
                action: {
                    click: function(event){ // call your custom function
                  }

                }
            }
        };
    } 

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.