vue-table icon indicating copy to clipboard operation
vue-table copied to clipboard

search

Open qlf123 opened this issue 8 years ago • 12 comments

Table can be field search

qlf123 avatar Aug 22 '16 08:08 qlf123

@qlf123 .. ??? .. What do you mean???

ratiw avatar Aug 22 '16 12:08 ratiw

Hello. I almost got it all working except on the search. Im getting this error when trying to search "Uncaught ReferenceError: n is not defined". I hope you can help me with this

ojnavi32 avatar Sep 01 '16 05:09 ojnavi32

@ojnavi32 You need to give me more information. If I have to guess, it probably be somewhere in your code that reference to variable n that is not defined.

ratiw avatar Sep 01 '16 06:09 ratiw

I am using laravel 5.3 and I created a component for the vuetable. I used the twitter bootstrap codes of yours its working fine but the search is not working. My api is based on the code on your sample data using laravel.

ojnavi32 avatar Sep 01 '16 06:09 ojnavi32

Do you know if the error happens on the client side or the server side? At least you need to know this first. The error might be in your javascript (client side) or in php (server side).

My example code does not contain any n variable.

ratiw avatar Sep 01 '16 06:09 ratiw

Thank you for your help. I think the problem is in the client side in my js because I can filter in my api.

Can you explain sir how are you doing on setFilter method. Is there any other method to replace the codes in the function, any other methods?

ojnavi32 avatar Sep 01 '16 07:09 ojnavi32

It only appends filter parameter to the query string that will be appended to the api-url. searchFor is a textbox that you enter the filter string. moreParams is bound to vuetable's append-params prop. vuetable:refresh is the event that asks vuetable to reload the data using the current parameters.

            setFilter: function() {
                this.moreParams = [
                    'filter=' + this.searchFor
                ]
                this.$nextTick(function() {
                    this.$broadcast('vuetable:refresh')
                })
            },

ratiw avatar Sep 01 '16 07:09 ratiw

@ratiw I try to use :append-params="$store.state.t.searchParams" to bind search criteria object but it doesn't work when executing event this.$refs.vuetable.refresh(). Is there any method to bind search criteria with store ( I use vuex)?

diskman avatar Nov 13 '16 22:11 diskman

@diskman I don't use vuex myself, so I'm not sure. And, no, there is no method in vuetable that will bind search criteria with store. In my opinion, binding search criteria directly to vuex looks kind a weird.

But have you try using computed function instead of referencing the $store directly in your template?

ratiw avatar Nov 14 '16 07:11 ratiw

@ratiw because I use vue 2.0 version I was not able to use

 this.$nextTick(function() {
                    this.$broadcast('vuetable:refresh')
                })

I have used

this.moreParams = this.$store.getters.searchParams
...
this.$refs.vuetable.refresh()

It is ok, but now I am not able to construct moreParams object with array eg { criteria1: 0 criteria2: [ 3, 4, 5 ] }

because [] is encoded into 2%5B%5D

diskman avatar Nov 14 '16 19:11 diskman

@diskman Ah, you're using vuetable-2. I'm a little bit confuse on what problem you're trying to solve then.

By the way, append-params is an object, you cannot assign an array to it.

ratiw avatar Nov 15 '16 01:11 ratiw

@ratiw sorry for confusion, I try to get it more clear here - "supporting append-paramas object containing array type property"

diskman avatar Nov 15 '16 15:11 diskman