Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #113104
    linda05
    Participant

    What’s the best way to handle events in Smart Grid?

    #113115
    Markov
    Keymaster

    Hi,

    In the Grid’s API Docs – https://www.htmlelements.com/docs/grid-api/, take a look at the events section which shows how to handle events.

    Here is an example for reference:

    <smart-grid
      #grid
      [dataSource]="data"
      [columns]="columns"
      (cellBeginEdit)="onCellBeginEdit($event)"
      (cellEndEdit)="onCellEndEdit($event)"
      (rowSelect)="onRowSelect($event)"
    ></smart-grid>
    
    onCellBeginEdit(event: CustomEvent) {
      const { row, column } = event.detail;
      console.log('Editing started for:', row, column);
    }
    
    onCellEndEdit(event: CustomEvent) {
      const { row, column, value } = event.detail;
      console.log(<code>New value in ${column.dataField}:</code>, value);
    }
    
    onRowSelect(event: CustomEvent) {
      console.log('Selected row:', event.detail.row);
    }

    Hope this helps.

    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.