GriddleGriddle / Griddle

Simple Grid Component written in React
http://griddlegriddle.github.io/Griddle/
MIT License
2.5k stars 378 forks source link

Filter placeholder and numeric sorting #774

Open zzz-code opened 7 years ago

zzz-code commented 7 years ago

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?

dahlbyk commented 6 years ago

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.

zzz-code commented 6 years ago

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

dahlbyk commented 6 years ago

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.

Saldivarcher commented 6 years ago

I made a pr for the first issue 😸

zzz-code commented 6 years ago

I'm curious and I will check it out