rubanraj54 / vue-bootstrap4-table

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

Column multi filter options from an array variable #19

Closed daoudzd closed 5 years ago

daoudzd commented 5 years ago

hi i can't use an array of items for column filter options, for example: array variable image

column image

result image

thank you.

rubanraj54 commented 5 years ago

Hi @daoudzd ,

can you please post all your list items?

Cheers, Ruby.

rubanraj54 commented 5 years ago

Hi @daoudzd ,

I see the problem now. You're referencing a data property to another data property. But this doesn't work in vue. Reference : https://stackoverflow.com/a/46491490/2708249

What you can possibily do is, let keep the options as empty array and assign the options in the mounted function.

For example, let say you have your options in Listes data variable and assign empty array to your options field in column config options : [] .

And in the mounted function assign the Listes values to the options field in the column config.

mounted() {
    let yourColumnIndex = 0;
    this.columns[yourColumnIndex].filter.options = this.Listes;
},

Hope this solves your problem.

Cheers, Ruby.

daoudzd commented 5 years ago

hello @rubanraj54 , thank you its working as you described 👍

image

rubanraj54 commented 5 years ago

Great, I am closing this issue now.

bureauvk commented 4 years ago

I am using the same setup, only the column isn't showing any results if I use this code:

{
 label: "Tags",
 name: "tags",
 filter: {
  type: "select",
  placeholder: "Search tags",
  mode: "multi",
  options: []
 },
 slot_name: "tags_field"
},

When I use this: name: "tags[0].id", The filtering is only working for the first object in the array.

Is it possible to filter on all the objects?