Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #112979
    michaelsanders
    Participant

    How do I bind data to the Smart Table?

    #112999
    Markov
    Keymaster

    Hi,

    You can use the dataSource property to data bind the table.

    <smart-table id="table"></smart-table>
    
    <script>
      const table = document.getElementById('table');
    
      table.columns = [
        { label: 'ID', dataField: 'id' },
        { label: 'Name', dataField: 'name' },
        { label: 'Email', dataField: 'email' }
      ];
    
      table.dataSource = [
        { id: 1, name: 'Alice', email: 'alice@example.com' },
        { id: 2, name: 'Bob', email: 'bob@example.com' },
        { id: 3, name: 'Charlie', email: 'charlie@example.com' }
      ];
    </script>

    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.