Base solution for your next web application
Open Closed

Angular permission filter improvement suggestion #12253


User avatar
0
daws created

Here's a suggestion to improve the permission filter in angular : include child nodes of the filtered permission.

BEFORE :

AFTER :

Here's my code for that :

filterPermission(nodes, filterText): any {
        _forEach(nodes, (node) => {
            let matchesFilter = node.data.displayName.toLowerCase().indexOf(filterText.toLowerCase()) >= 0;

            if (matchesFilter) {
                node.styleClass = this.showParentNodes(node);
            } else {
                node.styleClass = 'hidden-tree-node';
            }

            if (node.children) {
                if (matchesFilter) {
                    for (let child of node.children) {
                        child.styleClass = '';
                        if (child.children) {
                            this.filterPermission(child.children, filterText);
                        }
                    }
                } else {
                    this.filterPermission(node.children, filterText);
                }
            }
        });
    }

1 Answer(s)
  • User Avatar
    0
    oguzhanagir created
    Support Team

    Hi daws

    Thank you for your suggestion to improve the permission search filter. We have created an issue for the situation you specified. You can follow the developments here. Good work.