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

Feature/add multiselect filter #587

Merged

Conversation

cassmbautista
Copy link
Contributor

Added feature #405

This new feature is to add a multiple selection option to vue-good table. Seen in the image below:

2019-08-06 at 12 27 PM

The changes made in this PR are:

  • Added library for multiselect options called: vue-select
  • Using new component added an option to the filter options to set the multiselect dropdown.
    • This option does a fuzy search on any of the selected options.
    • This feature will work with the specified types as well
    • This also works when reseting the table
  • Updated docs to include documentation for new filter options
  • Updated dev app to use new feature

@xaksis
Copy link
Owner

xaksis commented Aug 6, 2019

This is sweeet! @cassmbautista my only concern is adding another library for something that is not core to the table and might not be used by everyone.
I'm trying to trim down the existing ones to reduce the size (lodash etc). Is it possible to add this as a plugin for vue-good-table? that way you can maintain it and people can optionally add it if they want to use it?

@cassmbautista
Copy link
Contributor Author

@xaksis Yea I was concerned about that too since I noticed you have very little dependencies. However, I have no idea how to add it as a plugin for vue-good-table. Any ideas? Do you have any examples of plugins to components?

@xaksis
Copy link
Owner

xaksis commented Aug 6, 2019

Good point. I was actually thinking of making a column-manager plugin for VGT myself to figure out how that'd work. Mind if I hold off on this for a bit? Then we can use that as a template if it works.

@cassmbautista
Copy link
Contributor Author

Yea, you can hold off on this for a while. I am also interested in the functionality of the column-manager plugin.

@TheJaredWilcurt
Copy link
Collaborator

@xaksis
I was wanting a column manager option as well. My design for it would have been a button or icon that opens a pop-out menu with all columns listed in a scrollable area. Each column name would have a grabber icon on the left to drag it up/down to reorder them and a checkmark to the right of the column name to show/hide that column.

My original mockup:

mockup

The default sort allows the user to pick which column to sort by by default.

@xaksis
Copy link
Owner

xaksis commented Aug 6, 2019

haha @TheJaredWilcurt that's pretty much exactly what I have implemented in the project that I was planning to refactor. Glad to see it validated!

@bhargavjoshi
Copy link

Guys (@cassmbautista, @xaksis) while you are discussing the column plugin, it can be a good idea to give an autocomplete function in the filter (let say you want to filter by a particular user, and there are 1000s of the user and autocomplete server fetching is a good option) for those using remote mode

@TheJaredWilcurt
Copy link
Collaborator

@bhargavjoshi
This PR uses vue-select which has that capability. I'm not sure if this PR supports that, but it could be an additional follow up PR to add that functionality if it doesn't.

@bhargavjoshi
Copy link

@cassmbautista, @xaksis

I was thinking about giving users the ability to use their own filter component.

Right now we have these options.

filterOptions: {
  enabled: true,
  filterValue: '',
  placeholder: "Show All",
  filterDropdownItems: ['']
}

We can add a property for a component like this

filterOptions: {
  enabled: true,
  filterValue: '',
  component: '<MyCustomComponent :attr1="attr1" @change="functionToSetFilterValue" />'
}

We have to think about how we can pass data to the component and also get data from the component.

My use case Is I want to give two text inputs with labels to put min amount and max amount. (basically a range filter).

Let's discuss more on this.

@paulhuisman
Copy link

Nice work! Would love to see this get integrated!

@cassmbautista
Copy link
Contributor Author

@xaksis Have you been able to make an example plugin for vue-good-table, so that I can convert this PR to a plugin?

@xaksis
Copy link
Owner

xaksis commented Oct 11, 2019

@cassmbautista really sorry but I have been very busy with another project. When I get a breather I'll get on it! I will keep you updated.

@ghost
Copy link

ghost commented Dec 4, 2019

It's looking good. Can't wait to see it integrated or as a plugin :)

@talbotseb
Copy link

Hi @xaksis !
Thanks a lot for your good work even if it lets us a bit dependant ...
Any idea about when you'll be able to come back on this project ?
It'll be nice to get some extra-features. If you're busy, maybe there is somebody here who could help you ?

Thanks anyhow !

@TheJaredWilcurt TheJaredWilcurt mentioned this pull request Feb 11, 2020
return column;
})
.filter(this.isMultiselectDropdown)
.map(column => column.ref);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can probably be a filter > map instead of map > filter > map

@TheJaredWilcurt
Copy link
Collaborator

TheJaredWilcurt commented Feb 17, 2020

size-increase

Merging this in means a 15% increase in the payload size (since it will now include the vue-select dependency). If this can be set up as an optional dependency or to be tree-shakable that would be ideal. However I'm also fine with that being a follow up issue.

@TheJaredWilcurt TheJaredWilcurt merged commit 1cba945 into xaksis:master Feb 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants