Im trying to figure out how to get the current filtered items from the Griddle component.
I found the following function in the source-code:
var filteredDataSelector = exports.filteredDataSelector = (0, _reselect.createSelector)(dataSelector, filterSelector, function (data, filter){
return data.filter(function (row) {
return Object.keys(row.toJSON()).some(function (key) {
return row.get(key) &&
row.get(key).toString().toLowerCase().indexOf(filter.toLowerCase()) > -1;
});
});
});
But how would I use the filteredDataSelector in my react-component? I would like to get the filtered items when clicking a button export to excel.
I found this example on how to interact with each item (to render hyperlink instead of just plain text) in the list which I think should work in a similair way to what I want to achieve: https://github.com/GriddleGriddle/Griddle/issues/586
I dont really understand how this works with redux and the connect function, but example above worked just fine.
Not sure if I have to use redux/connect in a similair way to get the filtered list of items?
Griddle-documentation: https://griddlegriddle.github.io/Griddle/docs/
Assuming you're using
LocalPlugin
, you would usefilteredDataSelector
in an enhancer/container to inject the prop into your presentation component. Roughly:If you're not using
LocalPlugin
, you're on your own asdata
is expected to be managed externally.