Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

239
Views
React.js Mui Treeview: cómo hacer en nodeselect no colapsar

Estoy tratando de hacer que Treeview no colapse cada vez que selecciono un nodo. Cuando se selecciona un nodo, aparecerá un botón según el nodo que haya seleccionado. Aquí hay un ejemplo que hice. https://codesandbox.io/s/summer-water-33fe7?file=/src/App.js

about 4 years ago · Santiago Gelvez
2 answers
Answer question

0

TreeItem tiene un accesorio disabled que no permitirá al usuario contraer el TreeItem al hacer clic. Puede establecer dinámicamente el valor del accesorio disabled cuando no desea que se colapse.

Por ejemplo :

 const [disabled, setDisabled] = useState(true); <TreeItem nodeId="5" label="Five" disabled={disabled}> // setDisabled(false); // Set to false when we want it to be collapsable.
about 4 years ago · Santiago Gelvez Report

0

Encontré una manera, pero no estoy seguro de si esta es la mejor manera, así que básicamente agregué todas las identificaciones que quiero que se expandan todo el tiempo, es decir, todas las identificaciones en los datos.

 const DataTreeView = ({ treeItems }) => { return ( <TreeView defaultCollapseIcon={<ExpandMoreIcon />} defaultExpandIcon={<ChevronRightIcon />} defaultExpanded={[ "root", "root2", "Parent 1", "Parent 2", "Parent 3", "Parent 4", "1", "2", "3", "4" ]} onNodeSelect={action} > {getTreeItemsFromData(treeItems)} </TreeView> ); };
about 4 years ago · Santiago Gelvez Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!