#112820
Markov
Keymaster

Hi,

The simplest way is:

<smart-table id="table"></smart-table>

<script>
const table = document.getElementById('table');

// Initial data
let data = [
    { id: 1, name: 'Alice', age: 25 },
    { id: 2, name: 'Bob', age: 30 }
];

table.dataSource = data;

// Listen for changes
table.addEventListener('endEdit', (event) => {
    const { row, dataField, value } = event.detail;
    // Update the external model
    data[row][dataField] = value;
    console.log('Updated data:', data);
});
</script>

By handling the endEdit event and syncing with the data source.

Best regards,
Markov

Smart UI Team
https://www.htmlelements.com/