Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Paper Container Optional #119

Closed
ghost opened this issue Dec 17, 2018 · 18 comments
Closed

Make Paper Container Optional #119

ghost opened this issue Dec 17, 2018 · 18 comments
Assignees
Labels
enhancement New feature or request

Comments

@ghost
Copy link

ghost commented Dec 17, 2018

Could we make the table wrapper optional? I prefer my table style without a Paper container.

@mbrn
Copy link
Owner

mbrn commented Dec 18, 2018

Why not. I will add a Container property to components.

@mbrn mbrn self-assigned this Dec 18, 2018
@mbrn mbrn added the enhancement New feature or request label Dec 18, 2018
@mbrn
Copy link
Owner

mbrn commented Dec 22, 2018

I am working on this.

@mbrn mbrn closed this as completed in bbc3839 Dec 22, 2018
@mbrn
Copy link
Owner

mbrn commented Dec 22, 2018

This is done. This will be in next release(1.9.0) in a few days.

How to use:
If you dont want nothing to cover component you can use React.Fragment. Or div like in example below.

<MaterialTable
 components={{
  Container: props => <div style={{background: '#AAA'}}>{props.children}</div>,
	//Container: React.Fragment
  }}
  columns={[
	{ title: 'Adı', field: 'name', filtering: false, render: () => <div>merhaba</div> },
	{ title: 'Soyadı', field: 'surname', filtering: false },
	{ title: 'Doğum Yılı', field: 'birthYear', type: 'numeric' },
	{ title: 'Doğum Yeri', field: 'birthCity', lookup: { 34: 'İstanbul', 63: 'Şanlıurfa' }, filtering: false }
  ]}
  data={[
	{ name: 'Mehmet', surname: 'Baran', birthYear: 1987, birthCity: 63 },
  ]}
  title="Demo Title"
/> 

@eluchsinger
Copy link

Can we add an example for this? It was hard to find any documentation on this. If you can't do it, maybe I find time for it this week.

@mbrn
Copy link
Owner

mbrn commented Mar 20, 2019

Hi @eluchsinger

Try this:

<MaterialTable
                ....
                components={{
                  Container: props => props.children
                }}
              />

@eluchsinger
Copy link

@mbrn yes, thanks. I could solve it already. I was just giving feedback so you could add an official example as it wasn't easy to find the example hidden in this issue.

@Monteyne
Copy link

Monteyne commented Apr 9, 2019

@mbrn Hello,
is there any other way to change container style ? i just want to change paper elevation to 0.
this method works; but seems like higher components can't access to DOM elements that rendered from props.children. Material-ui popover menu doesn't work on props.children elements

@mbrn
Copy link
Owner

mbrn commented Apr 9, 2019

@Monteyne

Try this:

<MaterialTable
....
components={{
Container: props => <Paper {...props} elevation={0}/>
}}
/>

@Monteyne
Copy link

Monteyne commented Apr 10, 2019

@mbrn having same result, no difference.

https://ibb.co/7260rf6 this is the screenshot of working version (without components)
https://ibb.co/2hHMbWG this is the screenshot of NOT working version (with components)

any idea ?

@mbrn
Copy link
Owner

mbrn commented Apr 10, 2019

@mbrn having same result, no difference.

https://ibb.co/7260rf6 this is the screenshot of working version (without components)
https://ibb.co/2hHMbWG this is the screenshot of NOT working version (with components)

any idea ?

link are broken. Can you fix them?

@Monteyne
Copy link

@mbrn sure, updated

https://ibb.co/7260rf6 this is the screenshot of working version (without components)
https://ibb.co/2hHMbWG this is the screenshot of NOT working version (with components)

@Monteyne
Copy link

@mbrn any luck ?

@mbrn
Copy link
Owner

mbrn commented Apr 19, 2019

@Monteyne

I still can not access to screenshots. Can you create a codesandbox please?

@Monteyne
Copy link

@mbrn sure
https://codesandbox.io/s/p9my8o9on7

when you click on vertical menu icon, you will see the bug

if we remove components property from table component, it will work as expected

@mbrn
Copy link
Owner

mbrn commented Apr 19, 2019

It is related with using a functional component when overriding Container.

Look at this: https://codesandbox.io/embed/1301mq3knj

@stbn694
Copy link

stbn694 commented Apr 10, 2020

@mbrn This just solved a similar problem for me. Care to explain the reason? Just curious

@difagume
Copy link

Hello @mbrn, I used:

components={{ Container: props => <Paper {...props} elevation={0}/> }}

to hide the Paper of the table because in my project the page that presents the table is contained by a Dashboard.js as a parent page and this dashboard includes a Paper, but I would like help indicating how I can hide the line that is placed under the pagination, I have an example here: https://codesandbox.io/s/gracious-sea-l7sgc

thank you very much

@emanuelegurini
Copy link

emanuelegurini commented Dec 7, 2021

It is related with using a functional component when overriding Container.

Look at this: https://codesandbox.io/embed/1301mq3knj

I have the same issue with the popover menu: how can i fix it?
I need to override the Container component too: can you restore the sandbox, please?

Thank you in advance for your reply.

@mbrn

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants