material-ui

How to expand more/less only one ListItem using single method in react

£可爱£侵袭症+ 提交于 2021-02-20 02:38:54
问题 I found what i need on this link https://material-ui.com/components/lists/#simple-list using material-ui. On this link there is chapter "Nested list items". This chapter have only one nested list item with method for expand more/less. I have two nested items in my sidebar. Both of them call a method handleClick for expand more/less options. I want to expand only one (clicked) nested item per click. I also want to expand less on previous item. Here is my sidebar: import React from "react";

How to expand more/less only one ListItem using single method in react

筅森魡賤 提交于 2021-02-20 02:38:43
问题 I found what i need on this link https://material-ui.com/components/lists/#simple-list using material-ui. On this link there is chapter "Nested list items". This chapter have only one nested list item with method for expand more/less. I have two nested items in my sidebar. Both of them call a method handleClick for expand more/less options. I want to expand only one (clicked) nested item per click. I also want to expand less on previous item. Here is my sidebar: import React from "react";

How to use custom 'editComponent' in material-table?

若如初见. 提交于 2021-02-19 10:38:54
问题 I'm trying to use 'material-table' in my project. My 'icon' column contains icon name. I need change this icon by selecting it from external dialog. I have problem with updating table data from external dialog. When I use 'input' element and I change icon name, it works correctly. editComponent: props => ( <input type="text" value={props.value} onChange={e => props.onChange(e.target.value)} /> ) I don't know, how to achive this result with my dialog. I've created the following snipped project

How to use custom 'editComponent' in material-table?

六眼飞鱼酱① 提交于 2021-02-19 10:38:24
问题 I'm trying to use 'material-table' in my project. My 'icon' column contains icon name. I need change this icon by selecting it from external dialog. I have problem with updating table data from external dialog. When I use 'input' element and I change icon name, it works correctly. editComponent: props => ( <input type="text" value={props.value} onChange={e => props.onChange(e.target.value)} /> ) I don't know, how to achive this result with my dialog. I've created the following snipped project

How to use custom 'editComponent' in material-table?

只愿长相守 提交于 2021-02-19 10:37:13
问题 I'm trying to use 'material-table' in my project. My 'icon' column contains icon name. I need change this icon by selecting it from external dialog. I have problem with updating table data from external dialog. When I use 'input' element and I change icon name, it works correctly. editComponent: props => ( <input type="text" value={props.value} onChange={e => props.onChange(e.target.value)} /> ) I don't know, how to achive this result with my dialog. I've created the following snipped project

Material-UI 4.8.1 API change - new way to specify the `component` property?

久未见 提交于 2021-02-19 06:49:05
问题 Edit : This was a bug in the typing of 4.8.x, upgrade to 4.9.0+ to fix the issue. On version 4.8.0 , the following code compiles and runs fine: <DialogContent> {/* use a span so we can nest div, p, etc. */} <DialogContentText component="span"> {confirmContent} </DialogContentText> </DialogContent> After upgrading to 4.8.1 the code now fails type-checking with: No overload matches this call. Overload 1 of 2, '(props: DialogContentTextProps, context?: any): ReactElement<any, string | ((props:

Material-UI: either `image` or `src` property must be specified

老子叫甜甜 提交于 2021-02-18 22:54:52
问题 Its looks like CardMedia need an image while component is created. Since I am pulling the image data via componentDidMount (RestAPI) then the component is already mount. componentDidMount() { // get all items via category ID and owner ID const restApi = new API({ url: 'api' }) restApi.createEntity({ name: 'items' }) // api/items/<categoryId>/<ownerId> restApi.endpoints.items.getTwo({ id_a: this.props.categoryId, id_b: this.props.ownerId }).then(({ data }) => this.setState({ appData: data }))

Fit parent height for Table in Material UI?

时光毁灭记忆、已成空白 提交于 2021-02-18 19:31:04
问题 I want the table height to fit the parent’s available height. Ideally, I want: The footer to always be docked at the bottom of the parent container. If the table contains a few rows, the footer should remain docked at the bottom. If the table contains more rows than fit the parent’s height and needs to overflow then the overflow should be visible only for the table body, and the footer should remain docked at the bottom and not be pushed downwards. A flexbox approach if possible (it seems to

material-ui makeStyles: how to style by tag name?

梦想的初衷 提交于 2021-02-18 11:47:08
问题 I want to add a rule for all <p> in the current component. I couldn't find information anywhere (material-ui documentation, Stack Overflow, etc.) on how to add CSS rules by tag name. Is it not supported? I'm trying to do something like this: const useStyles = makeStyles((theme: Theme) => createStyles({ 'p': { margin: 0, }, someClass: { fontSize: 14, }, }) ); EDIT: Using Ryan's solution works, but creates a new problem: import React from 'react'; import { makeStyles, Theme, createStyles } from

material-ui makeStyles: how to style by tag name?

ぐ巨炮叔叔 提交于 2021-02-18 11:47:07
问题 I want to add a rule for all <p> in the current component. I couldn't find information anywhere (material-ui documentation, Stack Overflow, etc.) on how to add CSS rules by tag name. Is it not supported? I'm trying to do something like this: const useStyles = makeStyles((theme: Theme) => createStyles({ 'p': { margin: 0, }, someClass: { fontSize: 14, }, }) ); EDIT: Using Ryan's solution works, but creates a new problem: import React from 'react'; import { makeStyles, Theme, createStyles } from