Griddle icon indicating copy to clipboard operation
Griddle copied to clipboard

Use custom filter input component

Open reggi opened this issue 11 years ago • 6 comments

I have a custom search box I'd like to use as the filter. When it is submitted (onSubmit) I'd like to call a function to filter Griddle where I can pass the query. Does this exist?

reggi avatar Sep 16 '15 17:09 reggi

Still looking for a solution. :bomb:

reggi avatar Oct 02 '15 19:10 reggi

I'll respond, as I know @ryanlanciaux is traveling today. I'm not 100% on exactly how, but you should be able to use refs to set the filter. I think you'd say show filter={false} then make your custom input reference griddle.refs.search or whatever its called. We know this isn't the ideal solution, but there should be some updates coming soon for this type of situation.

blkmutt avatar Oct 02 '15 20:10 blkmutt

Thanks @blkmutt I can't find any documentation on griddle.refs.search. I would love more information on being able to have a custom search box when it arrives. :)

reggi avatar Oct 14 '15 00:10 reggi

I was able to use a custom filter by performing the following steps. I am fairly new to ReactJS so I am not sure if this is the best way to do this.

I attached a "ref" to the Griddle component: <Griddle ref='Griddle' results={results} columnMetadata={columnMeta} ... />

Then, in the onChangeHandler function (attached to my custom filter) I was able to: this.refs.Griddle.setFilter("Your Text Here")

This would perform the filter on the Griddle Component.

Phillips126 avatar Nov 13 '15 15:11 Phillips126

This works great @Phillips126 - thank you!

mewejo avatar Nov 19 '15 14:11 mewejo

In addition to using refs as described above (or function for obtaining refs) we have added additional customization features to Griddle. Any component used in griddle can now be passed in as an override and this functionality could be achieved through passing in custom components. Please see customization in the latest Griddle docs for more information. :+1:

ryanlanciaux avatar Feb 24 '17 11:02 ryanlanciaux