Steps to include a horizontal divider in the footer section of an angular-material table

Is it possible to add a line between the last row (Swimsuit) and the footer line (Total)? If so, how can I achieve this using Angular 15?

https://i.stack.imgur.com/581Nf.png

Answer №1

The CSS code below can be used to reveal the line of the last row!

css

.footer-border-needed .mdc-data-table__row:last-child .mat-mdc-cell {
  border-bottom-color: var(
    --mat-table-row-item-outline-color,
    rgba(0, 0, 0, 0.12)
  ) !important;
  border-bottom-width: var(--mat-table-row-item-outline-width, 1px) !important;
  border-bottom-style: solid !important;
}

html

<table
  mat-table
  [dataSource]="dataSource"
  class="mat-elevation-z8 footer-border-needed"
>
  <!--- These columns can be defined in any order.
        The actual rendered columns are set as a property on the row definition" -->

  <!-- Position Column -->
  <ng-container matColumnDef="position">
    <th mat-header-cell *matHeaderCellDef>No.</th>
    <td mat-cell *matCellDef="let element">{{element.position}}</td>
    <th mat-header-cell *matFooterCellDef>Symbol</th>
  </ng-container>

  <!-- Name Column -->
  <ng-container matColumnDef="name">
    <th mat-header-cell *matHeaderCellDef>Name</th>
    <td mat-cell *matCellDef="let element">{{element.name}}</td>
    <th mat-header-cell *matFooterCellDef>Symbol</th>
  </ng-container>

  <!-- Weight Column -->
  <ng-container matColumnDef="weight">
    <th mat-header-cell *matHeaderCellDef>Weight</th>
    <td mat-cell *matCellDef="let element">{{element.weight}}</td>
    <th mat-header-cell *matFooterCellDef>Symbol</th>
  </ng-container>

  <!-- Symbol Column -->
  <ng-container matColumnDef="symbol">
    <th mat-header-cell *matHeaderCellDef>Symbol</th>
    <td mat-cell *matCellDef="let element">
      <mat-form-field
        appearance="outline"
        class="no-bottom-space custom-form-field"
      >
        <mat-label>Outline form field</mat-label>
        <input matInput placeholder="Placeholder" />
      </mat-form-field>
    </td>
    <th mat-header-cell *matFooterCellDef>Symbol</th>
  </ng-container>

  <tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
  <tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
  <tr mat-footer-row *matFooterRowDef="displayedColumns"></tr>
</table>

Check it out on StackBlitz

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Having trouble establishing a default value for Material Multiselect in Angular 6

I am currently attempting to incorporate a multiselect feature in an Angular application using Material design. However, I am encountering an issue where the default selected types are not working as expected when the page is opened in Edit mode. Displaye ...

Is there a way for the remaining divs in a column to match the width of the widest div?

I'm attempting to ensure that the divs in a column take the width of the widest element, with the exception of the top div which should span 100% of the screen. How can this particular layout be achieved? Please refer to the image below for a clear ex ...

Angular Notification not visible

I have been attempting to display a notification after clicking a button using the angular-notifier library (version: 4.1.1). To accomplish this, I found guidance on a website called this. Despite following the instructions, the notification fails to app ...

How to invoke a function from a different controller in Ionic 2

Is it possible to call a function in another controller within Ionic 2? Here is my code where I want to call the loadPeople function in the tab controller. home.ts import { Component } from '@angular/core'; import { NavController } from ' ...

Accessing an object from a webpage using Selenium: A step-by-step guide

Today marks my debut using Selenium IDE, and I must admit that my knowledge of web development is limited. My team is currently working on a website, and as part of my task, I need to write tests for it. The website features several charts showcasing data ...

Conceal HTML elements from the bottom as new content is being added dynamically

I am currently working on a comments feed feature. By default, only the first four comments are displayed, with an option to show more when clicking the "show more" anchor. The issue I'm facing is that if new comments are dynamically added, the CSS hi ...

Unable to connect to 'formGroup' as it is not recognized as a valid property of 'form' within the component on the page

Currently, I am in the process of developing an app using Ionic. One of the pages I have created is called survey, and its corresponding component is known as SurveyPage. Within this page, there are various texts displayed along with a component tagged as ...

Is ngOnDestroy in Angular 2 triggered on page refresh, or only when navigating away from the component?

Can anyone clarify whether the ngOnDestroy method in Angular 2 is triggered on page refresh or only when navigating away? ...

What could be causing such a significant impact on the row height in a CSS table when a tiny image is inserted next to an input box?

Currently, I am facing a unique challenge while setting up a form using CSS tables. The issue is best explained through a fiddle: http://jsfiddle.net/GdgV4/6/ In the third row, you'll notice that adding an image with a height less than the input box ...

What is the process for creating a pop-up bubble that appears when the cursor hovers over an image displayed within a table using R Shiny?

I am currently working on code that is almost achieving my desired functionality. I want to make it so that hovering over each question mark in the table will trigger a pop-up bubble displaying the help text, rather than having the text appear at the botto ...

How can you give a custom icon to the 'startIcon' of a MaterialUI button?

Below is the current code I am using: import { Button, Grid, Typography, } from '@material-ui/core'; import EditOutlinedIcon from '@material-ui/icons/EditOutlined'; <Grid item> <Button variant="outlined" ...

md-input-container malfunctioning

I am facing an issue with the code using "@angular/material": "^2.0.0-beta.1" import { MaterialModule, MdIconRegistry, OVERLAY_PROVIDERS, MdInputContainer, MdInputDirective } from '@angular/material' .... <md-input-container> <i ...

"Enhance your listening experience with an audio player featuring album covers as captivating

Is there a way to create an audio player with the album cover image serving as the background, while ensuring all control buttons are displayed on top of that same image? I attempted using the following code snippet: <audio controls = 'controls&ap ...

Tips for deploying an Angular Universal 9 application on a live server

Our Angular 9 app functions perfectly when deployed on an IIS server. We also have a version of the app that has been integrated with Universal by another company. Now, we need to figure out how to deploy our app with server-side rendering into productio ...

The routing functionality in an Angular Element seems to be malfunctioning when used in a separate Angular project. Instead of displaying the expected routes, only the "<router-outlet></router-outlet>" tags are visible on the website

The current situation: Our team is facing the challenge of integrating multiple angular frontend micro-services into a single application. To achieve this, we have chosen to use the Angular-Elements approach which resulted in a large JS-file when exportin ...

Looking to center the numbers in my ordered list within a border box - any tips on how to achieve this?

I'm attempting to create a numbered order list with a circular border around it. The goal is to have the number of the list item centered within the circular border and the entire circle centered within the paragraph. Currently, both the number and th ...

Elevate the React experience by smoothly sliding a fixed navbar upwards when scrolling down, and elegantly sliding it

tl;dr Don't miss the solution at the end! Looking to create a slide up and down effect on a fixed navbar in react? What's the best approach - using refs or the componentDidMount lifecycle hook? hideNav = (navbar) => { const hide = () ...

Adjusting the font color when hovering over multiline text

I am currently in the process of coding a website for my job, and I am working on changing the text color when it is hovered over. However, there seems to be a break in my code causing the text not to highlight all at once. Any guidance or suggestions on h ...

Sticky positioning causing issue with Bootstrap dropdowns

I'm attempting to design a data table with a sticky column that includes a Bootstrap dropdown button. Unfortunately, the dropdown conflicts with the sticky position and ends up opening behind the fixed column. It looks fine when opened from the top en ...

Basic progress bar

I'm attempting to create a basic download bar, but it's only displaying as a solid color without any transition animation. Furthermore, the "repeating-linear-gradient" feature isn't functioning and I'm struggling to figure out why. I&a ...