Griddle icon indicating copy to clipboard operation
Griddle copied to clipboard

Filter placeholder and numeric sorting

Open zzz-code opened this issue 6 years ago • 5 comments

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?

zzz-code avatar Nov 24 '17 23:11 zzz-code

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:

  1. Add filterPlaceholder to initialState.textProperties
  2. Use textSelector in FilterContainer to add that value to props (e.g. PreviousButtonContainer
  3. Use the new props value in Filter

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.

dahlbyk avatar Nov 29 '17 21:11 dahlbyk

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

zzz-code avatar Dec 01 '17 16:12 zzz-code

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.

dahlbyk avatar Dec 01 '17 19:12 dahlbyk

I made a pr for the first issue 😸

Saldivarcher avatar Dec 21 '17 20:12 Saldivarcher

I'm curious and I will check it out

zzz-code avatar Dec 21 '17 20:12 zzz-code