Utilizing mat dialog in conjunction with the bootstrap sticky top class to enhance functionality

I am encountering an issue where, upon clicking to delete an entry, a mat dialog should appear with everything else in the background greyed out. However, the problem I am facing is that when I attempt to delete an entry, the dialog appears but the sticky top (in this case, the header) remains unaffected by the greying out. The log component is situated within the details component, so when the dialog pops up, everything except the sticky header is greyed out. Any insights on how to address this issue or why this behavior is occurring?

Tools being used: Angular Material version 12.2.13 and Bootstrap version 5.1.

log.component.html

<div class="row mx-auto">
      <table mat-table [dataSource]="LogSource" class="mat-elevation-z8 orange">
        
        // ...other table content goes here

        <ng-container matColumnDef="Delete">
          <th mat-header-cell *matHeaderCellDef></th>
          <td mat-cell *matCellDef="let element" (click)="deleteEntry(12)">
            <button class="btn btn-danger">
              <i class="bi bi-x"></i>
            </button>
          </td>
        </ng-container>

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

log.component.ts

import { Component, OnInit} from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { LogMessageComponent } from 'src/app/dialogs/log-message/log-message.component';

@Component({
  selector: 'app-log',
  templateUrl: './log.component.html',
  styleUrls: ['./log.component.scss'],
})
export class LogComponent implements OnInit {

  displayContactLogColumns = [
    'CreatedDateTime',
    'CreatedByUser',
    'ContactType',
    'Study',
    'Outcome',
    'OutcomeDetails',
    'Notes',
    'Delete',
  ];
  LogSource: any[];
  errorMessage: string;

  constructor(
    public dialog: MatDialog
  ) {
    this.LogSource = [];
    this.errorMessage = ''
  }

  deleteLog(Id: number) {

    if (deleteLog !== -1) {
      // I'm enforcing a delete for now
    } else {
      const errorMessage = `Could not find log with id of ${Id}`;
      this.dialog.open(LogMessageComponent);

      throw new Error(errorMessage);
    }
  }
}

sticky.component.ts This is where the sticky section is located.

<section id="details" class="container">
  <!-- SUMMARY -->
  <header id="demo" class="mt-3 sticky-top bg-body">
    <div class="row">
      //Some code goes here
    </div>
  </header>
</section>

Answer №1

Testing was not possible for me earlier, but you might be able to resolve your issue by creating a css class that will "grey out" the entire screen, like this:

.hideFullScreen {
  background:grey;
  position:absolute;
  top:0px;
  right:0px;
  bottom:0px;
  left:0px;
}

Then, set up a material dialog configuration for your dialog and apply the 'hideFullScreen' class css to it:

if (deleteContact !== -1) {
      //I'm forcing a delete for now
    } else {
      const errorMessage = `Could not find log with id of ${Id}`;
      const dialogConfig = new MatDialogConfig();
      dialogConfig.panelClass = 'hideFullScreen';      
      this.dialog.open( ContactLogMessageComponent, dialogConfig );

      throw new Error(errorMessage);
    }
  }

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

Issues with rendering images in the browser due to CSS inline-block layout are causing

I have encountered an issue with two divs that are set to 50% width and displayed inline-block. Each div contains an image. I expected both divs to stay on the same line, but sometimes the browser breaks the layout. Here is the HTML code snippet: <div ...

Unable to retrieve module from directive template in Angular

I am currently working on creating a wrapper component for ngAudio. This wrapper will act as the player with controls and will interact with ngAudio's functions. However, I am facing some scope issues with it. I can inject ngAudio into the component&a ...

Trouble setting custom attribute tags in Ionic 4

Trying to apply custom attributes within a ngFor loop is proving challenging for me. <ng-container *ngFor="let a of this.current_items?.areas; let i = index"> ... I've made several attempts: <div class="productBatchArea" custom-data=&apo ...

Upon removing an element, the button click event fails to trigger

I recently created a div that looks like this <div id="hidden"> <img src="photos/Close-2-icon.png" width="16" height="16"> <input id="add" value="Add field" type="button" > <input type='button' id=&a ...

Steps to resolve the issue with "Error: StaticInjectorError(AppModule)[NgbDropdown -> ChangeDetectorRef]"

My attempt at creating a web app using Angular resulted in successful compilation with no errors. However, upon execution, the browser displays a blank page accompanied by the following error message: ERROR Error: Uncaught(in promise): Error: St ...

Having several contact forms embedded within a single webpage

I am currently in the process of developing a prototype website and my objective is to have multiple forms on a single page. My goal is to have a form for each service, where users can click on the service and fill out a form to request a quote. The first ...

JQuery AJAX click event not triggering

I'm currently working on a project to create a dynamic website where users can update text fields directly from the site. However, I've encountered an issue on the 'admin' page where nothing happens when the button is pressed to set the ...

Tips for utilizing the value of object1.property as a property for object2

Within the template of my angular component, I am attempting to accomplish the following: <div> {{object1.some_property.(get value from object2.property and use it here, as it is a property of object1)}} </div> Is there a way to achieve this ...

Angular4 + Universal + ng-bootstrap triggering an 'Unexpected token import' error

I recently made the leap to upgrade my angular version from 2+ to 4+ in order to take advantage of the universal package for server-side rendering, specifically for SEO purposes. Following the necessary steps and configurations outlined at https://github.c ...

Leverage the power of JavaScript validation combined with jQuery

Hello, I'm relatively new to the world of Javascript and jQuery. My goal is to create a suggestion box that opens when a user clicks on a specific button or div element. This box should only be visible to logged-in users. I have some knowledge on how ...

How can I style the options and optgroups of a select dropdown with CSS, focusing on padding and margins?

In my experience, I have found that padding or margin CSS properties only seem to affect the appearance of options within the select menu in Firefox browser. I attempted the same styling in Internet Explorer and Chrome but it did not have any effect. Is ...

How to access the current class in Sass without referencing the parent class

.site-header .basket position: relative &-container width: 100% padding: 0 18px $basket: & &.opened #{$basket}-link border: 1px solid #e5e5e5 ...

Issues with Bootstrap form functionality

I found inspiration on http://getbootstrap.com and decided to enhance it by including a hidden input. The file result.php contains $_REQUEST. Only the hidden value is visible to me. <form class="form-horizontal" role="form" action="/requests/result.p ...

ReactJS textarea component failing to update after state change

I'm currently working on developing a note-taking and organizing application, but I've encountered a frustrating bug. Here is the code for my component: import React from 'react'; const Note = (props) => { let textarea, noteForm ...

Align Text Center inside a Magical H1 Heading Tag

I'm having a bit of trouble with something that should be simple. I want to center the text inside my h1 tag on a wizard, and I've added this CSS to my stylesheet.css: .h1textalign { text-align:center; } Here's how I'm trying to apply ...

What is the best way to keep track of a checkbox's value after unchecking it and then returning to the same slide?

Issue: By default, the checkbox is always set to true in the backend code. Even if I uncheck it using JavaScript, the value remains as true when switching between slides. Desired Outcome: If I uncheck the checkbox, the updated value should be saved so tha ...

Thymeleaf: Expression parsing error

I am working on a Thymeleaf template that includes pagination functionality. <ul class="results_perpage" > <li th:if="${previous != null}"><a th:href="javascript:movePage(`${previous}`);" class="results_menu" th:text="PREVIOUS">< ...

Utilizing AngularJs to differentiate between arrays and strings within an HTML template

I'm currently facing a challenge with creating a dynamic HTML template. In order to present data in a table, I need to distinguish between a regular String and an Array. Firstly, the HTML template is embedded within another template using the data-ng- ...

Struggling to eliminate HTML entities in PHP

Hey everyone, I've been attempting to sanitize a string with HTML entities using PHP, but I'm running into some issues. Below is a snippet of my code: $body = "Mal ein neuer &amp;lt;b&amp;gt;Test&amp;lt;/b&amp;gt;&amp;lt;br& ...

How to Customize the Navbar Position in Bootstrap 3 when the Brand/Logo is Collapsed

I am currently in the process of creating my first website and experimenting with the Bootstrap 3 framework. The navbar I have selected is designed to adjust based on screen size, collapsing into a small button for use on tablets and mobile devices. Howe ...