Griddle
Griddle copied to clipboard
Filter placeholder and numeric sorting
Griddle version
1.9.0
Hi, is there an option to change the filter placeholdertext to something like search without writing a custom filter component? I think it is much overdone to add a custom component only to change the placeholder text.
Second thing is the way of sorting. For example if i have numbers it sorts like:
1 10 100 1000 2 3
instead of
1 2 3 10 ...
How can I solve this?
is there an option to change the filter placeholdertext to something like search without writing a custom filter component? I think it is much overdone to add a custom component only to change the placeholder text.
Not currently, but this should be a relatively easy patch if you want to submit a PR:
- Add
filterPlaceholder
toinitialState.textProperties
- Use
textSelector
inFilterContainer
to add that value toprops
(e.g.PreviousButtonContainer
- Use the new
props
value inFilter
Once connected to textProperties
, you can override the text from a plugin or directly.
Second thing is the way of sorting. For example if i have numbers it sorts like...
You can provide a custom sortMethod
either for the entire grid or specific columns. Check out how this custom sort function is used in the Storybook.
If it is possible to change the textproperties for next and previous than it should also be possible to change other values like the placeholder. Let me try to find a workaround with the use of textSelector
I agree that it should be possible. And the Filter placeholder isn't the only example of hard-coded text that could be converted to use textSelector
(e.g. NoResults
, Loading
).
If you're not interested in contributing, we'll try to fix this as time allows.
I made a pr for the first issue 😸
I'm curious and I will check it out