rubanraj54 / vue-bootstrap4-table

Advanced table based on Vue 2 and Bootstrap 4 ⚡️
MIT License
219 stars 57 forks source link

Bug: initial value for global search doesn't work #54

Closed nullday closed 5 years ago

nullday commented 5 years ago

Hey there!

I try to assign initial value for search input:

config: {
                    ...
                   global_search: {
                        init: {
                            value : "Christin"
                        }                        
                    },
                    ...
                }

But the actual input value is empty, like there is no initial value. data.global_search.init.value - is correct. data.query.global_search - is fine as well.

I've tried to fix it locally inside your library and it worked. I've just added $nextTick, like this:

this.$nextTick(() => {
                   this.$refs.global_search.value = this.global_search.init.value;
});
rubanraj54 commented 5 years ago

Hi @nullday

This is a strange issue, it is working perfectly in my local machine and not working in the codepen example.

I guess it depends on the different machine's power, so I fixed it by calling initGlobalSearch() function inside $nextTick. Now I can see the init value in the global search input box in all different machines.

Thanks for reporting this bug and it is fixed in the new release (1.1.9)

Cheers, Ruby.

nullday commented 5 years ago

That was a fast fix! Thanks.