One way to display buttons only for the first row in a mat-table

I am working with a mat-table that displays a list of executing Jobs. Currently, there are stop and re-execute buttons in front of all the rows. However, I now want to only show the button on the first row. How can I achieve this?

Here is the code for the buttons in my mat-table:

<ng-container matColumnDef="actions">
    <mat-header-cell *matHeaderCellDef> </mat-header-cell>
    <mat-cell *matCellDef="let element; let index = index">
        <button
            mat-icon-button
            (click)="stop_exec_job(element)"
            matTooltip="Stop Executing the Job"
            [disabled]="element.status == 'Completed' || element.status == 'FINISH'"
        >
            <!-- Edit icon for row -->
            <i class="material-icons" style="color:red"> stop </i>
        </button>

        <button
            mat-icon-button
            (click)="re_run_job(element)"
            matTooltip="Re-Run the Job"
            [disabled]="
                element.status == 'RUNNING' ||
                element.status == 'Pending'
            "
        >
            <i class="material-icons" style="color:green"> cached </i>
        </button>
    </mat-cell>
</ng-container>

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

Unable to retrieve values from JSON objects within an array

My array consists of multiple objects, each containing specific properties such as: [ { "id":17368, "creationDate":1566802693000, "status":"InProgress", "type":"NEW", "agentType":"Master" }, { "id":17368, ...

The div is incorrect and causing the label and input to move in the wrong direction

Whenever I try to adjust the position of the current-grade-name-input, the entire grade-point-input moves along with it inexplicably. /* final grade calculator: (wanted-grade - (current-grade * (1 - final%))) / final% Ex: have a 80 an ...

How to bring in images from the assets folder using React and Typescript

I'm facing an issue where direct image importing is working, but when using object types, it's not functioning properly. Why could this be happening? I am currently working with "react": "^16.12.0" and "typescript": "~3.7.2" // ./src/assets/baby ...

Enhance user experience by turning the entire card into a clickable element through targeting the <a> tag nested

I need to make the entire card clickable to go to a specific link, but I can't wrap the card with an anchor tag. Is there a way to target the anchor tag within the card and trigger it when the user clicks anywhere on the card using jquery? Desired ou ...

Ways to utilize setActiveTab from a different JavaScript file

I am currently experimenting with a TabGroup feature in my application, but I encountered an issue when trying to utilize the setActiveTab function from a separate JavaScript file. The problem arises specifically when attempting to click button3 located w ...

There seems to be a delay in reading data when I switch a component from stateless to stateful

Initially, I had a stateless component that was reading data perfectly on time. However, when I needed to convert it into a stateful component for my requirements, it stopped functioning as expected. The component would display empty data and wouldn't ...

Attempting to isolate SQL outcome in order to adjust price based on a percentage

I am currently working on a SQL search and results page that displays 3 columns of data: category, number, and price. However, the results are returned all together in one big lump. My goal is to have a dropdown list with percentages, where clicking on one ...

How come Typescript claims that X could potentially be undefined within useMemo, even though it has already been defined and cannot be undefined at this stage

I am facing an issue with the following code snippet: const productsWithAddonPrice = useMemo(() => { const addonsPrice = addonsSelected .map(id => { if (addons === undefined) { return 0} return addons.find(addon => addo ...

Unable to visualize object in three.js

Looking to generate cubes in a random location on the page using a for loop, but currently experiencing issues where the cubes are not appearing as expected. **Note: When I check the cube with console log, this is the output: ** -cube.js:24 Mesh {uuid ...

Transforming a sophisticated nested array containing named values into JSON format

I am facing a challenge with converting an array into JSON format. The array, named classProfiles, has the following structure (seen after inspecting console output): Buildings_clear: Array(0) band1: [Min: 24, Max: 24, Mean: 24, Median: 24, StdDev: 0] ...

What is the best way to include parameters when calling $resource.query in AngularJS?

Currently, the url localhost/view/titles is set up to use the specific route, controller, and service described below. When accessed, the server will return a list of all title objects. How can the service be expanded to accommodate additional query para ...

Creating a personalized script in ReactJS: A step-by-step guide

If I have already built a component with Google Chart in ReactJS, and I want to implement a feature that allows the Legend to show/hide data using a JavaScript script provided here, how and where should I integrate this code to work with my chart? Here is ...

How can I configure the domain in a Localstorage offline JS app to access local storage from multiple HTML files?

For a small JS/HTML app I am developing, I need to store preferences in LocalStorage and access them from two different HTML files. While it works fine when staying on the same HTML file, accessing the stored data from another HTML page poses a challenge. ...

What is preventing Typescript from inferring the type when assigning the output of a method with a return type to a variable?

My reusable service has a public API with documentation and types to make client usage easier. interface Storable { setItem(key: string, value: string): any; getItem(key: string): string; removeItem(key: string): any; } @Injectable({ providedIn: & ...

Executing multiple child processes in a loop with asynchronous operations and collecting the output after the loop concludes

Here's a snippet of code I've been working on... const { exec } = require('child_process'); const Main = async () => { const result = await RetrieveAllItems(); console.log('output', result); }; const RetrieveAllI ...

Let's compare the usage of JavaScript's toUTCString() method with the concept of UTC date

When I fetch the expiry date time in UTC from the Authentication API along with a token, I use the npm jwt-decode package to extract the information. private setToken(value: string) { this._token = value; var decoded = jwt_decode(value); this._ ...

Creating an array from objects without manual effort

Greetings everyone, currently I am structuring my array in the following manner: var piece1 = new DialoguePiece(null, questions[0], 0, 0, 4, 1); var piece2 = new DialoguePiece(null, questions[1], 1, 0, 2, 3); var piece3 = new DialoguePiece(scripts[1], nul ...

angular api datatable: data not found

I am currently facing an issue while trying to display data from this API in a table: . Although the HTML structure of my table is showing up correctly, the data from the API is not being displayed and there are no errors in the console. Does anyone have ...

Validating a particular value using Regex in React Formik

First, I need to ensure that the field is validated for any characters not included in this set: /[ùûüÿ€’“”«»–àâæçéèêëïîôœ]/. If a user enters a character outside of this set, I want Yup to trigger an error message. Secondly, I ...

How can I clear the cache for GetStaticPaths in NextJs and remove a dynamic route?

This question may seem basic, but I can't seem to find the answer anywhere online. Currently, I am diving into NextJs (using TypeScript) and I have successfully set up a site with dynamic routes, SSR, and incremental regeneration deployed on Vercel. ...