datatable - Angular Material 2 Inline buttons inside md-cell how to -
can give example of angular material 2 datatable inline buttons inside cell ?? can't make work... button allways appear 1 below other.
my code following not working:
<div class="example-container mat-elevation-z8"> <!--filtering input fiels--> <div class="example-header"> <md-input-container floatplaceholder="never"> <input mdinput #filter placeholder="Αναζήτηση"> </md-input-container> </div> <md-table #table [datasource]="incidentsdatasource" mdsort> <ng-container cdkcolumndef="protocolno"> <md-header-cell *cdkheadercelldef md-sort-header> Αρ. Πρωτοκόλλου</md-header-cell> <md-cell *cdkcelldef="let row"> {{row.protocolno}}</md-cell> </ng-container> <ng-container cdkcolumndef="date"> <md-header-cell *cdkheadercelldef md-sort-header> Ημερομηνία</md-header-cell> <md-cell *cdkcelldef="let row"> {{row.date | date:'dd/mm/yyyy' }}</md-cell> </ng-container> <ng-container cdkcolumndef="patient"> <md-header-cell *cdkheadercelldef md-sort-header> Ασθενής</md-header-cell> <md-cell *cdkcelldef="let row"> {{row.patient.lastname}} {{row.patient.firstname}}</md-cell> </ng-container> <ng-container cdkcolumndef="doctor"> <md-header-cell *cdkheadercelldef md-sort-header> Ιατρός</md-header-cell> <md-cell *cdkcelldef="let row"> {{row.doctor.lastname}} {{row.doctor.firstname}}</md-cell> </ng-container> <ng-container cdkcolumndef="signingdoctor"> <md-header-cell *cdkheadercelldef md-sort-header> Υπογράφων Ιατρός</md-header-cell> <md-cell *cdkcelldef="let row"> {{row.signingdoctor.lastname}} {{row.signingdoctor.firstname}}</md-cell> </ng-container> <ng-container cdkcolumndef="clinic"> <md-header-cell *cdkheadercelldef md-sort-header> Κλινική</md-header-cell> <md-cell *cdkcelldef="let row"> {{row.clinic?.name}}</md-cell> </ng-container> <ng-container cdkcolumndef="ispayed"> <md-header-cell *cdkheadercelldef md-sort-header> Πληρωμή</md-header-cell> <md-cell *cdkcelldef="let row"> {{row.ispayed | payment}}</md-cell> </ng-container> <ng-container cdkcolumndef="actions"> <md-header-cell *cdkheadercelldef> Ενέργειες</md-header-cell> here cell data
trying here display buttons inline in cell not working
<div style="display: inline-block;"> <button md-button (click)="showandprint(row)" > <md-icon class="md-18">visibility</md-icon> εκτ </button> <button md-button (click)="edititem(row)" style="display: inline-block;"> <md-icon class="md-18">mode_edit</md-icon> επεξ </button> <button md-button (click)="deleteitem(row)" style="display: inline-block;"> <md-icon class="md-18">delete</md-icon> διαγ </button> </div> </md-cell> </ng-container> <md-header-row *cdkheaderrowdef="displayedcolumns"></md-header-row> <md-row *cdkrowdef="let row; columns: displayedcolumns;"></md-row> </md-table> <md-paginator #paginator [length]="incidentsdatasource.size" [pageindex]="0" [pagesize]="10" [pagesizeoptions]="[10, 25, 50, 100]"> </md-paginator> </div> thanks in advance
setting width of column of actions should solve problem.
add following components .scss file:
.mat-column-actions { flex: 0 0 300px; } change 300px value whatever fits needs!
Comments
Post a Comment