Topic: Capturing data from Table Editor Add/Edit modal
Please help me setup an event listener to capture the record from the table after I click save in the edit or add modal.
I need to know what event to listen to, and how to capture the data from the modal form. My code below shows the example I am following, and I am able to log tableModal out to the console, but I can't get any further.
const tableModal = new TableEditor(
document.getElementById('table_modal'),
{
columns: advancedColumns,
rows: advancedRows
},
{ mode: 'modal', entries: 5, entriesOptions: [5, 10, 15] }
);
console.log(tableModal);
Thanks!
Resources (screenshots, code snippets etc.)![screencapture - edit modal]
Grzegorz Bujański staff answered 4 years ago
you should use event updateEntry.mdb.tableEditor
. It returns the entire row of values after the change.
const tableModalEl = document.getElementById('table_modal');
const tableModal = new TableEditor(
tableModalEl,
{
columns: advancedColumns,
rows: advancedRows,
},
{ mode: 'modal', entries: 5, entriesOptions: [5, 10, 15] }
);
tableModalEl.addEventListener('updateEntry.mdb.tableEditor', (e) => {
console.log(e.row);
});
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- User: Pro
- Premium support: Yes
- Technology: MDB Standard
- MDB Version: 3.2.0
- Device: mac
- Browser: chrome
- OS: os
- Provided sample code: No
- Provided link: No