How to search by properties

Right now the CTRL + F shows a search bar that can search elements by label or id. I have added the properties-panel-list-extension to my modeler which creates a parameter to an element. So, I want to modify the search function to search by the parameter’s id as well.

You’d need to implement a custom search pad provider: diagram-js/lib/features/search-pad/SearchPadProvider.ts at develop · bpmn-io/diagram-js · GitHub

    elements = map(elements, function(element) {
        return {
            primaryTokens: matchAndSplit(getLabel(element), pattern),
            secondaryTokens: matchAndSplit(element.id, pattern),
            tertiaryTokens: matchAndSplit(element.businessObject.extensionElements.values || '', pattern),
            element: element
        };
    });

I am trying to call the parameter’s name inside the searchProvider js file. What is the correct way of calling the parameter names? Currently this line is giving errors element.businessObject.extensionElements.values

Note that element.businessObject.extensionElements.values may not exist for some elements. So you should check if property exists, e.g.

const extensionElements = element.businessObject.get('extensionElements');

if (!extensionElements) return '';
...
1 Like

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