JavaScript UI Libraries & Blazor Components Suite – Smart UI Forums Table Would love to hear thoughts on: Table.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #112809
    dadsa
    Participant

    How do I handle two-way binding with Smart Table?

    #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/

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.