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

162
Views
Anulando la función de agregar fila en la tabla de materiales

Quiero ejecutar una función antes de que se abra la fila de agregar editable. ingrese la descripción de la imagen aquí Antes de que se abra esta interfaz de usuario, quiero ejecutar una función. (como console.log('Hello') ) Este es mi código de tabla de materiales actual.

 <MaterialTable title="Timesheet" columns={columns} data={DataArray} icons={tableIcons} editable={{ onRowAddCancelled: rowData => console.log('Row adding cancelled'), onRowUpdateCancelled: rowData => console.log('Row editing cancelled'), onRowAdd: newData => new Promise((resolve, reject) => { setTimeout(() => { // add row }, 1000); }), }} options={{ actionsColumnIndex: -1, addRowPosition: "first", search:false, exportButton: true, }} />
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Puede poner el código que desea ejecutar en la función de devolución de llamada onRowAdd, por ejemplo

 <MaterialTable title="Timesheet" columns={columns} data={DataArray} icons={tableIcons} editable={{ onRowAddCancelled: rowData => console.log('Row adding cancelled'), onRowUpdateCancelled: rowData => console.log('Row editing cancelled'), onRowAdd: newData => { console.log('Hello'); return new Promise((resolve, reject) => { setTimeout(() => { // add row }, 1000); }); } }} options={{ actionsColumnIndex: -1, addRowPosition: "first", search:false, exportButton: true, }} /> );

Si desea llamar a su función al hacer clic en el botón +, debe agregar las acciones . Por ejemplo

 <MaterialTable actions={[ { icon: 'add', tooltip: 'Add User', isFreeAction: true, onClick: (event) => alert("You want to add a new row") } ]} />
about 4 years ago · Juan Pablo Isaza 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!