Skip to content

Filter in tree in controller #144

Open
@LTroya

Description

@LTroya

Is currently a way to filter in controller?

I am doing it this way for the moment:

function treeSearch() {
       // I tried using angular.copy instead of this method
       // to reset the data but it doesn't work
       on_treeData_change();

        var results = $filter('searchFor')(scope.tree_rows, scope.queryString, scope.expandingProperty, scope.colDefinitions, true);

        $timeout(function () {
             scope.tree_rows = results;
        });
 }

The problem I have with this solution is if I expand or collapse a filtered object it expands all nodes from original tree. It should expand filtered nodes

The weird is ng-click only do this

row.branch.expanded = !row.branch.expanded

This was my original template

<tr ng-repeat="row in tree_rows | searchFor:$parent.filterString:expandingProperty:colDefinitions:true track by row.branch.uid"

But with this solution I can't expand or collapse nodes because it is filtering all the time

If there is a way to do it I will appreciate any hint

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions