Vue-Router Query Not Recognized

Published 6 months ago by jgravois

I have a large listing of items each with an "expanded" attribute set to false by the model.

If ?id=## is not appended to the path, I need all collapsed -- works! if there is an ?id=##, I need to expand the corresponding row (so the executive know which one to approve (even though there is a filter provided)).

I added the following computed property but all rows remain collapsed and the debug alert doesn't fire

filtered_returns() {
                if(this.returns) {
                    if (this.search && this.search.length === 0) {
                        if(this.$route.query && this.$route.query != undefined) {
                            alert(this.$route.query.id);
                            _.each(this.returns, function(r) {
                                if(r.id == this.$route.query.id) {
                                    r.expanded = true;
                                } //end if
                            });
                            return this.returns;
                        } else {
                            return this.returns;
                        } // end if
                    } else {
                        return this.returns.filter((rma) => {
                            return rma.company_name.toLowerCase().indexOf(this.search.toLowerCase()) !== -1
                        });
                    } //end if
                } // end if
            }
Best Answer (As Selected By jgravois)
jgravois

I figured it out ... thanks!

jgravois

I figured it out ... thanks!

Please sign in or create an account to participate in this conversation.