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

MenuItem grouping Still not available #17125

Closed
M4urici0GM opened this issue Aug 23, 2019 · 4 comments
Closed

MenuItem grouping Still not available #17125

M4urici0GM opened this issue Aug 23, 2019 · 4 comments
Labels
duplicate This issue or pull request already exists

Comments

@M4urici0GM
Copy link

I saw some issues opened in nov. 2017, and today it's still not available.
When it will ?

@oliviertassinari
Copy link
Member

oliviertassinari commented Aug 23, 2019

I saw some issues opened in nov. 2017

@M4urici0GM Could you link it, or even better follow our issue template? What are you looking for? I'm clueless. Are interested in something like this?

Capture d’écran 2019-08-23 à 23 57 15

import React from 'react';
import Button from '@material-ui/core/Button';
import Menu from '@material-ui/core/Menu';
import ListSubheader from '@material-ui/core/ListSubheader';
import MenuItem from '@material-ui/core/MenuItem';
import Divider from '@material-ui/core/Divider';

export default function SimpleMenu() {
  const [anchorEl, setAnchorEl] = React.useState(null);

  function handleClick(event) {
    setAnchorEl(event.currentTarget);
  }

  function handleClose() {
    setAnchorEl(null);
  }

  return (
    <div>
      <Button aria-controls="simple-menu" aria-haspopup="true" onClick={handleClick}>
        Open Menu
      </Button>
      <Menu
        id="simple-menu"
        anchorEl={anchorEl}
        keepMounted
        open={Boolean(anchorEl)}
        onClose={handleClose}
      >
        <ListSubheader>
          Group 1
        </ListSubheader>
        <MenuItem onClick={handleClose}>Profile</MenuItem>
        <MenuItem onClick={handleClose}>My account………</MenuItem>
        <Divider />
        <ListSubheader>
          Group 2
        </ListSubheader>
        <MenuItem onClick={handleClose}>Logout</MenuItem>
      </Menu>
    </div>
  );
}

@oliviertassinari oliviertassinari added the status: waiting for author Issue with insufficient information label Aug 23, 2019
@M4urici0GM
Copy link
Author

Im looking for something based on that:
Screenshot_1
There's category, and sub-categories. Basically i want split them in groups, similar to the print.
I was trying to use TextField with select prop,
Obviously it wont work since jsx do not allow it.

<TextField select variant="outlined" value={fetchedProduct.category} onChange={(e) => console.log(e.target.value)} value={fetchedProduct.category} margin="dense" helperText="Escolha a categoria" label="Categoria do produto." color="primary" className={classes.textField}>
    {categories.map((category, index) => (
        <MenuItem className={classes.category} key={subCategory.id} id={subCategory.id}>{subCategory.name_categoria}</MenuItem>
            category.sub_category.map(subCategory => (
            <MenuItem className={classes.subCategory} key={subCategory.id} id={subCategory.id}>{subCategory.name_categoria}</MenuItem>
        ))
    ))}
</TextField>

@oliviertassinari oliviertassinari added docs Improvements or additions to the documentation and removed status: waiting for author Issue with insufficient information labels Aug 26, 2019
@oliviertassinari
Copy link
Member

It should be supported. You can either use the native select mode or keep use the non native variant (your example) while keeping the children in flat array.

@oliviertassinari oliviertassinari added duplicate This issue or pull request already exists and removed docs Improvements or additions to the documentation labels Oct 6, 2019
@oliviertassinari
Copy link
Member

Let's move the discussion to #2671

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants