bogdan / datagrid

Gem to create tables grids with sortable columns and filters
MIT License
1.02k stars 115 forks source link

Textarea filters #309

Closed bartoszkopinski closed 8 months ago

bartoszkopinski commented 1 year ago

https://github.com/bogdan/datagrid/blob/master/Readme.markdown#filters already mentions text filters, but I couldn't find it so I added them.

bogdan commented 1 year ago

Previously, I didn't interoduce new filter types in case when the difference from existing one is only in the UI. Example filter(:categories, :enum, checkboxes: true). I believe we should follow this policy this time too and introduce an option to string filter.

However, I think the option you are going to introduce will be pretty rare. If there is an adequate way how we can make datagrid configurable to introduce such an option, that would be a better approach. I would also want to think of it for some time before merging anything.

bartoszkopinski commented 1 year ago

@bogdan This filter is a bit different at the moment since it does not include RangedFilter but I can also see it having additional logic in the future. In general textareas behave a bit differently from inputs (eg. different html options, newlines). This seems a bit cleaner but I don't mind either way.

bogdan commented 8 months ago

In the end, I decided to support {input_options: {type: 'textarea'} as a way to convert <input type="text"/> to <textarea/>. I believe this is better way of doing things as it is only related to interface. Please try it out with v1.8.0 and let me know if it works for you.