Topic: How to change mdbTable hover color?
Damian Gemza staff answered 5 years ago
Dear @1001albertpadilla
The code which you have provided doesn't have [hover]="true"
input. So the hover effect won't work.
After you'll add that input, hover effect will work, and you'll be able to change the background color after hover.
Best Regards,
Damian
Damian Gemza staff answered 5 years ago
Dear @1001albertpadilla
Please add the below code to the styles.scss
global stylesheet:
.table.table-hover tbody tr:hover {
background-color: red;
}
Best Regards,
Damian
1001albertpadilla free commented 5 years ago
The solution doesn't seem to work -- table mdbTable #tableEl="mdbTable" class="z-depth-1 table-responsive" mdbTableScroll striped="true"
Arkadiusz Idzikowski staff commented 5 years ago
Could you paste here the HTML you use to render this table (or link to the documentation if it's one of our examples). It will be easier to provide a solution for the specific table structure.
1001albertpadilla free commented 5 years ago
<table mdbTable #tableEl="mdbTable" class="z-depth-1 table-responsive" mdbTableScroll striped="true" scrollY="true" maxHeight="500">
<thead>
<tr scope="col">
<th scope="row"></th>
<th class="custom-datatable-header" [mdbTableSort]="elements" sortBy="code">Code <mdb-icon fas icon="sort"></mdb-icon></th>
<th class="custom-datatable-header" [mdbTableSort]="elements" sortBy="name">Name <mdb-icon fas icon="sort"></mdb-icon></th>
<th class="custom-datatable-header" [mdbTableSort]="elements" sortBy="address">Address <mdb-icon fas icon="sort"></mdb-icon></th>
<th class="custom-datatable-header" [mdbTableSort]="elements" sortBy="displayStatus">Status <mdb-icon fas icon="sort"></mdb-icon></th>
<th class="custom-datatable-header">Action</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let el of elements; let i = index">
<th *ngIf="i+1 >= mdbTablePagination.firstItemIndex && i < mdbTablePagination.lastItemIndex"
scope="row" style="padding: 7px;">{{i + 1}}</th>
<td *ngIf="i+1 >= mdbTablePagination.firstItemIndex && i < mdbTablePagination.lastItemIndex" style="padding: 7px; font-size: 13px;">{{el.code}}</td>
<td *ngIf="i+1 >= mdbTablePagination.firstItemIndex && i < mdbTablePagination.lastItemIndex" style="padding: 7px; font-size: 13px;">{{el.name}}</td>
<td *ngIf="i+1 >= mdbTablePagination.firstItemIndex && i < mdbTablePagination.lastItemIndex" style="padding: 7px; font-size: 13px;">{{el.address}}</td>
<td *ngIf="i+1 >= mdbTablePagination.firstItemIndex && i < mdbTablePagination.lastItemIndex" style="padding: 7px; font-size: 13px;">
<mdb-badge *ngIf="el.status == true" pill="true" primary="true" class="p-1">{{el.displayStatus}}</mdb-badge>
<mdb-badge *ngIf="el.status == false" pill="true" warning="true" class="p-1">{{el.displayStatus}}</mdb-badge>
</td>
<td *ngIf="i+1 >= mdbTablePagination.firstItemIndex && i < mdbTablePagination.lastItemIndex" style="padding: 7px; font-size: 13px;">
<button mdbBtn color="secondary" outline="true" rounded="true" size="sm" class="px-2 m-0" mdbWavesEffect (click)="openEditModal(el.warehouseId)">
<mdb-icon fas icon="pencil-alt"></mdb-icon>
</button>
</td>
</tr>
</tbody>
Damian Gemza staff commented 5 years ago
@1001albertpadilla You have provided us only the <thead>
markup. Please provide us with the <tbody>
too.
1001albertpadilla free commented 5 years ago
Please see updated codes above. Thanks.
Closed
This topic is closed.
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Closed
- ForumUser: Free
- Premium support: No
- Technology: MDB Angular
- MDB Version: 7.5.1
- Device: Laptop
- Browser: Chrome
- OS: Win 10
- Provided sample code: No
- Provided link: No