Can Angular Flex support multiple sticky columns at once?

I am trying to make the information columns in my angular material table stay sticky on the left side. I have attempted to use the "sticky" tag on each column, but it did not work as expected.

<table mat-table [dataSource]="dataSource" matSort class="mat-elevation-z8" >
  <ng-container matColumnDef="group" sticky>
    <th mat-header-cell class="group" *matHeaderCellDef mat-sort-header> Konzern </th>
    <td mat-cell class="group" *matCellDef="let element"> {{element.group}} </td>
  </ng-container>

  <ng-container matColumnDef="customer" sticky>
    <th mat-header-cell class="customer" *matHeaderCellDef mat-sort-header> Kunde </th>
    <td mat-cell class="customer" *matCellDef="let element"> {{element.customer}} </td>
  </ng-container>

  <ng-container matColumnDef="brand" sticky>
    <th mat-header-cell class="brand" *matHeaderCellDef mat-sort-header> Marke </th>
    <td mat-cell class="brand" *matCellDef="let element"> {{element.brand}} </td>
  </ng-container>


  <ng-container matColumnDef="subBrand" sticky>
    <th mat-header-cell class="subBrand" *matHeaderCellDef mat-sort-header> Submarke </th>
    <td mat-cell class="subBrand" *matCellDef="let element"> {{element.subBrand}} </td>
  </ng-container>

  <ng-container matColumnDef="subgroup" sticky>
    <th mat-header-cell class="subgroup" *matHeaderCellDef mat-sort-header> Untergruppe </th>
    <td mat-cell class="subgroup" *matCellDef="let element"> {{element.subgroup}} </td>
  </ng-container>

  <ng-container *ngFor="let week of this.displayedRowInformation; let i=index" [matColumnDef]="i.toString()">
    <th mat-header-cell class="week" [id]="i.toString()" *matHeaderCellDef> {{week.weeknumber}} </th>
    <td mat-cell class="week" *matCellDef="let element">
      <div style="position:relative">
        <div>{{ getEvent(week, element).description}}</div>
      </div>
    </td>
  </ng-container>

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

Answer №1

Maybe you'll find some useful information on this page. You can experiment with different options on the site to see what works best for you.

For more details, check out

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

Update links within a designated div section

How can I change the color and alignment of anchor tags within the third child div that is part of a set of three nested divs? These child divs are arranged side by side within a parent div with the class .logo-bckgrnd-rpt. Although I have successfully tar ...

The presence of a method is triggering an Error TS2741 message stating that the property is missing in type

Here is a simplified code snippet that highlights the issue I am facing: class Test { prop1 : boolean prop2 : string method() { } static create(prop1 : boolean, prop2 : string) : Test { let item : Test = { prop1: prop1, prop2: pro ...

The attribute 'do' is not defined in the AngularFireList type

Despite coming across numerous similar posts, I am still struggling to comprehend the issue at hand and how to resolve it. posts$: Observable<Post[]> = this.db .list(`posts/${this.uid}`) .do(next => this.store.set('posts', next) ...

What is the best way to dynamically load content as it enters the viewport using JavaScript or jQuery?

I have implemented a stunning animation to the h1 element using a function, but now I want the animation to trigger only when the h1 element enters the viewport as the user scrolls down. Currently, the animation occurs as soon as the page is loaded, even ...

jQuery is displaying fields inside the widget box that were supposed to have been removed

I am currently working on a project with a widget foldable box function called Metadata Widget. This widget displays certain fields, and I have added an import button to the side that calls upon the Metadata Widget and shows it. However, I have noticed tha ...

Issue with React/Next.js input field rejecting commas

I'm experiencing a problem with an input field in my React application that was developed using Next.js. The issue arises specifically when using an iPad device, where the input field behaves inconsistently when dealing with commas. When using deskto ...

What is the syntax for implementing an if-else statement?

Just starting with algolia and looking for a hit template. Please take a look at the script below for the text/html template needed: <script type="text/html" id="hit-template"> <div class="hit"> <div class="hit-image"> <i ...

Ionic app experiencing a CORS dilemma post-build

Using Ionic 3, I have written a provider code to fetch data from an API endpoint hosted on an HTTPS server. For example, my endpoint is located at . Below is the code for my provider: // Provider Class Function load(){ if(this.data){ return Pro ...

When you want to place an image in the middle of a cell, you can easily achieve this by utilizing the addImage function

I am currently utilizing the addImage() method within the exceljs library to insert an image into a cell of an Excel file that is exported from my Angular application. While I have successfully added the image using the addImage() method, it appears in t ...

Utilize Bootstrap 4 to seamlessly integrate a small element between two lengthy items in a row, ensuring a gap

I would like to achieve a similar look to this design. https://i.sstatic.net/p1hq4.png hr { border: none; color: black; background-color: black; height: 5px; margin-top: 10px; } <div class="row code-line"> <div class="col-5 ...

Testing Angular Library Before Release

My Angular library consists of modules, each containing services. I am looking for a way to easily test my library when I make changes to one of the services. Is there a simple solution that doesn't involve publishing and installing it in the main pr ...

Eliminate the golden hue from the input field when autofill is activated

Can anyone help me figure out how to get rid of this unsightly chrome background that appears when autofill is enabled? (See below for reference.) I've attempted the following solutions: *:focus { outline: 0; } input:-webkit-autofill { -webk ...

I'm having trouble with npm install, it's not working as expected

After downloading node.js, I encountered errors when trying to run the CLI command npm install -g @angular/cli: npm ERR! code ENOTFOUND npm ERR! errno ENOTFOUND npm ERR! network request to http://registry.npmjs.org/@angular%2fcli failed, reason: getaddrin ...

What is the reason behind In-memory-web-api not generating an ID?

While I have successfully implemented the GET, PUT, and DELETE methods using InMemoryDbService to simulate an API, I am facing issues with the CREATE method. It seems like the ID is not being generated in the route to display my add form. The error message ...

What is the best way to modify URLs in angular?

As a newcomer to Angular, I am currently working on an ecommerce project where my boss has requested URL rewrite behavior. For example. The website domain is abc.com and all the products are listed on the productlisting page abc.com/productlisting So, ...

What is the best way to merge multiple attributes into a single attribute in HTML?

Is there a way to set a margin for a section of my site without it treating each attribute individually? I want to treat them as one attribute instead. Here's an example: <div style="background-color: grey; padding: 13px;"> <h1>This p ...

Modify information in formArray

Let's take a look at this setup I have: Model: export class MapDetailModel{ id: number; lat: number; lon: number; alt: number; long: number; angle: number; distance?: number; pendenza?: number; } Html: <div clas ...

Avoid receiving input for a button that is being covered by another button

I am currently developing an Idle Game and I am looking to include 'buy buttons' for purchasing buildings, along with a sell button embedded within the buy button. Just as a heads up, these buttons are represented by DIVs acting as buttons. Here ...

Angular 9 is currently activating multiple routes simultaneously

I'm currently working on a user login feature that redirects users to the dashboard upon successful authentication. Although the entire process seems to be functioning correctly, I am facing an issue where both the login form component and the dashbo ...

Angular failing to detect Leaflet TimeDimension

Recently, I integrated leaflet-timedimension into an Angular project that utilizes ngx-leaflet. However, I encountered a hurdle when trying to utilize the geoJson time dimension feature. It appears that Angular is not recognizing the leaflet-timedimension ...