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

Error in vue-simple-suggest when item is selected #308

Open
PetroGromovo opened this issue Apr 17, 2020 · 1 comment
Open

Error in vue-simple-suggest when item is selected #308

PetroGromovo opened this issue Apr 17, 2020 · 1 comment

Comments

@PetroGromovo
Copy link

Hello,

In my vue/cli 4 / Bootstrap 4.3 app I make suggestion component(using vue-simple-suggest)
with some additive parameters and returning data I need to get slug
field of selected row and to redirect to other page
based on this slug. Search works ok for me, but when Item in selection list is selected
I see in browsers console one more request to database with whole selected item object and that
raise error.
I make:


                            <vue-simple-suggest
                                    id="search_string"
                                    v-model="search_string"
                                    display-attribute="name"
                                    value-attribute="slug"
                                    :list="simpleSuggestionList"
                                    autocomplete=off
                                    mode="select"
                                    @select="taskSuggestionSelected()"
                            ></vue-simple-suggest>

```and js code:
        simpleSuggestionList() {
            let filters={
                search_string : this.search_string, // search
                only_free : ( this.cbx_only_free ? 1 : 0), // additive parameters
                price_min : this.tasksPriceRange[0],
                price_max : this.tasksPriceRange[1],
                selectedCategories : this.getSelectedCategories
            }
            console.log('filters::')
            console.log(filters)
            return axios.post(this.apiUrl + '/tasks-search', filters, this.credentialsConfig)
                .then(({data}) => {
                    return data.tasks
                })
                .catch(error => {
                    console.error(error)
                    this.showPopupMessage('Tasks search', error.response.data.message, 'warn')
                })

            // return this.retArray
        },


        taskSuggestionSelected() {
            console.log('\'taskSuggestionSelected par1 ::\'+par1 +"  search_string::"+this.search_string::')
            return false
        }
1) Why error and how not to trigger request to server when item is selected and 
2) how can I save/ pass slug of selected item into taskSuggestionSelected method as I need to make redirection?

"vue": "^2.6.10",
"vue-simple-suggest": "^1.10.1",
Thanks!
@PetroGromovo
Copy link
Author

Sorry, I closed this topic by error.
Can I get unswer to it ?

@PetroGromovo PetroGromovo reopened this Apr 21, 2020
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