Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removeFilter cannot remove a PrecedenceGroup #7

Open
Chrissteven81 opened this issue Aug 3, 2017 · 1 comment
Open

removeFilter cannot remove a PrecedenceGroup #7

Chrissteven81 opened this issue Aug 3, 2017 · 1 comment

Comments

@Chrissteven81
Copy link

If you are reusing your joData object you often have to craft your filter on the fly and while going back to a capture will work as will reset filters it seems the ability to remove a filterclause from withing the group will be a better solution

@Chrissteven81
Copy link
Author

Chrissteven81 commented Aug 3, 2017

Something like this...May need to be optimized

removeFilter: function (property) {
            
            var i;
            var j;

            if (!this.FilterSettings.isSet()) {
                return this;
            }

            for (i = 0; i < this.FilterSettings.Filters.length; i++) {
                if (this.FilterSettings.Filters[i].filterObj.Property === property) {
                    this.FilterSettings.Filters.splice(i, 1);
                } else if (this.FilterSettings.Filters[i].filterObj.clauses != undefined) {
                    var filters = this.FilterSettings.Filters[i].filterObj.clauses;
                    for (j = 0; j < filters.length; j++)
                    {
                        if (filters[j].filterObj.Property === property)
                            filters.splice(j, 1);
                    }
                    if(filters.length == 0)
                        this.FilterSettings.Filters.splice(i, 1);
                }
            }

            return this;
        },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant