JavaScript UI Libraries & Blazor Components Suite – Smart UI › Forums › Table › how in component.ts work with events onclick ?
Tagged: events onclick smart-table
- This topic has 1 reply, 2 voices, and was last updated 1 year, 4 months ago by ivanpeevski.
Viewing 2 posts - 1 through 2 (of 2 total)
-
AuthorPosts
-
July 10, 2023 at 7:22 am #107452Andy RistarParticipant
i have table with button edit and delete. i want when i click on element delete_forever – send api http
this code in meeting.component.html <smart-table #grid id="grid" [dataSource]="dataSource" [paging]="meetingsDataSettings.paging" [sortMode]="meetingsDataSettings.sortMode" [tooltip]="meetingsDataSettings.tooltip" [onInit]="meetingsDataSettings.onInit" [columns]="meetingsDataSettings.columns" [filtering]="meetingsDataSettings.filtering" [filterRow]="meetingsDataSettings.filterRow" [pageIndex]="meetingsDataSettings.pageIndex" [pageSize]= "meetingsDataSettings.pageSize" [selection]="meetingsDataSettings.selection" [editing]="meetingsDataSettings.editing" (onCellEndEdit)="onItemAfterEdit($event)" ></smart-table>
this code in meeting.component.ts How in this place work with events onclick ? i have table with button edit and delete. columns: [ { label: 'id', dataField: 'id', dataType: 'number', responsivePriority: 3, width: 50 }, { label: 'Дата собрания', dataField: 'meetingDate', dataType: 'string', responsivePriority: 3 }, { label: 'Адрес', dataField: 'address', dataType: 'string', responsivePriority: 4 }, { label: 'Инициатор', dataField: 'initiator', dataType: 'string' }, { label: 'Кол-во собственников', dataField: 'ownerCount', dataType: 'number' }, { label: 'Кол-во вопросов', dataField: 'questionCount', dataType: 'number', responsivePriority: 3 }, { label: 'Статус собрания', dataField: 'meetingStatus', dataType: 'number', responsivePriority: 3 }, { label: 'Статус оплаты', dataField: 'paymentStatus', dataType: 'number', responsivePriority: 3 }, { label: 'Комментарий', dataField: 'comment', dataType: 'string', responsivePriority: 3 }, { label: '', dataField: 'action', allowEdit: false, width: 90, formatFunction: function (settings: any) { settings.template = '' + '<div class="actions-container">' + '' + '<i class="material-icons">edit</i>' + '' + '' + '<i class="material-icons">delete_forever</i>' + '' + '</div>'; } }, ], and i have meetingService.ts. This meetingService.ts have http method getMeetings FOR example
getMeetings (): Observable<any> { return this.http.get(this.meetingsUrl) .pipe( catchError(this.handleError('getMeetings', [])) ); } delete (): Observable<any> { some action ); }
- This topic was modified 1 year, 4 months ago by Andy Ristar.
- This topic was modified 1 year, 4 months ago by Andy Ristar.
July 10, 2023 at 3:39 pm #107455ivanpeevskiParticipantHi Andy,
Please see the demo here – https://www.htmlelements.com/demos/table/server-side-crud/
It shows you how to capture the click of a button inside a row. It can be achieved with event.target.closest()
Best Regards,
Ivan Peevski
Smart UI Team
https://www.htmlelements.com/ -
AuthorPosts
Viewing 2 posts - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.