material-table icon indicating copy to clipboard operation
material-table copied to clipboard

Override a single filter instead of FilterRow

Open nbrustein opened this issue 7 years ago • 4 comments

Is your feature request related to a problem? Please describe. When I want to provide a custom component to use for filtering, it seems that I have to implement the entire FilterRow.

Describe the solution you'd like Support a filterComponent property in the column definition. If defined, this component would replace the component that is used for filtering at the top of each column.

nbrustein avatar Sep 05 '19 18:09 nbrustein

+1

Since there is a editComponent prop, I think it would make sense to add filterComponent in coluns definition by following the same pattern.

gabrielgian avatar Sep 16 '19 12:09 gabrielgian

Would it help if FilterRow was exported and you could import and override it? We are hesitant of adding any additional props for everything - config is already kind of too big.

jayarjo avatar Oct 08 '19 08:10 jayarjo

I recognize that I didn't start this thread, so I hope I'm not posting out of turn, but it's been a while so I figure I'll add my 2 cents to get this issue moving. Yes, that is a valid way to solve it and I agree that the config is large, but IMO since there are multiple Filter types (lookup, input, etc…), the component prop override could get very messy when it comes to configuring the different filter types when compared to defining them as needed in the columns prop.

My use case is that I'm trying to build a very dense table for a tiny component, but I can't remove the margin-top of 16px from the filter lookup component. Additionally, the filter input bottom line is not aligned with the lookup bottom line.

This might be a duplicate of #379

Update: I was able to get over this hurdle with some CSS edits. For anyone like me who is just trying to change the styling of subcomponents in the table (as opposed to replacing the component or functionality) and who isn't yet aware of CSS selectors for dynamic classNames (diff between running your app in localhost versus running a build in dev/prod), you can access an automatically named class like this: [class*='MuiInput-formControl']

My full solution is as follows (and this solution actually makes my post off-topic, but it may be of use for people who chose to look behind this door:

[class*='AppealManagementBottomCenterModule'] [class*='MuiInput-formControl'] {
	margin-top: 0px;
}

janderson215 avatar Dec 07 '19 15:12 janderson215

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You can reopen it if it required.

stale[bot] avatar Jun 15 '20 09:06 stale[bot]