Controlling the z-index of Angular ngx daterangepicker

Having multiple forms in an expansion presents a unique challenge. I initially used the following code for a date picker:

<mat-form-field>
  <input formControlName="date" matInput placeholder="Date" type="date">
</mat-form-field>

This method was effective, as the expansion did not conceal it (see here). However, when incorporating start and end values for both date and time, I decided to switch to ngx material daterangepicker.

The issue I encountered is that the expansion ended up covering the daterangepicker (view image). Here's the revised code for the daterangepicker picker:

      <mat-form-field>
        <input
          matInput
          ngxDaterangepickerMd
          name="daterange"
          placeholder="Choose date"
          applyLabel="Okay"
          startKey="start"
          endKey="end"
          firstMonthDayClass="first-day"
          lastMonthDayClass="last-day"
          emptyWeekRowClass="empty-week"
          lastDayOfPreviousMonthClass="last-previous-day"
          firstDayOfNextMonthClass="first-next-day"
          [autoApply]="options.autoApply"
          [linkedCalendars]="options.linkedCalendars"
          [singleDatePicker]="options.singleDatePicker"
          [showDropdowns]="true"
          formControlName="date"

          [showWeekNumbers]="options.showWeekNumbers"
          [showCancel]="options.showCancel"
          [showClearButton]="options.showClearButton"
          [showISOWeekNumbers]="options.showISOWeekNumbers"
          [customRangeDirection]="options.customRangeDirection"
          [lockStartDate]="options.lockStartDate"
          [closeOnAutoApply]="options.closeOnAutoApply"
          [opens]="opens"
          [drops]="drops"
          [timePicker]="timePicker"
        />
      </mat-form-field>

I attempted to assign custom z-index values like:

.md-drppicker {
  z-index: 9999;
}

ngx-daterangepicker-material {
  z-index: 9999;
}

However, these adjustments were unsuccessful in resolving the issue. I also tinkered with the display and position properties, but to no avail.
Any insights on what might be causing this problem?

Edit: Check out this updated picture of the daterangepicker picker problem

Answer №1

To solve the problem of the calendar not fitting in properly, you can utilize the overflow attribute. This adjustment should help alleviate your issue.

.md-drppicker {
  z-index: 9999;
  overflow: auto; // You can also experiment with overflow-y;
}

ngx-daterangepicker-material {
  z-index: 9999;
  overflow: auto; // You can also experiment with overflow-y;
}

If the problem persists, I recommend sharing a stackblitz instance for further assistance.

Answer №2

Unfortunately, the ngx-daterangepicker is unable to function properly within the mat-form-field element.

Answer №3

Currently, I am utilizing version 2.4.1 of ngx-daterangepicker-material with Angular 6.1.10

We encountered an issue related to MatInput and angular-split-ng6 in our project.

To address this problem, we applied the following CSS fix:

.md-drppicker.drops-down-right.ltr.shown.double.show-ranges {
    position: fixed;
}

After implementing the above solution, our calendar displayed correctly without overlapping neighboring elements. Additionally, it no longer wrapped when launched from a constrained space that was smaller than the required width for showing the calendars side by side.

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

Loop through the ng-content elements and enclose each one within its own individual nested div

Although it is currently not supported, I am curious to know if anyone has discovered a clever solution to this problem. In my current setup, I have a parent component with the following template: <dxi-item location='after' class="osii-item- ...

Vertical Image Alignment in Bootstrap 3

Looking for some help with a basic HTML structure here. I have a single row divided into two columns, each containing an image of the same size. What I need is to center one image both horizontally and vertically in each column. <div class="containe ...

Slicknav is failing to appear on the screen, although it is being

After spending hours trying to implement a slicknav menu into my school project, I'm stuck and seeking guidance. Despite having some coding experience, I can't seem to find the solution to my problem. Any help, insight, or tips on fixing or impro ...

Utilizing HTML/CSS (with Bootstrap): Reveal the concealed <input type="color"> color selector by clicking on a different HTML component

Is there a way to trigger a color picker from a hidden <input type="color"> by clicking on another HTML element, like a <span>? While this functionality seems to work on Firefox, it consistently fails on Chromium. Are there any cross- ...

What could be causing the uneven application of CSS padding when it is applied to a div that serves as the parent of an HTML form?

Padding has been added only to the top and bottom of a div. The padding attribute is displaying consistently for the form element, however, it is not behaving uniformly for the parent div of the form as illustrated in the image provided below. Output:- h ...

Verify if the reactive form retains its original values

In my Angular 6 project, I have a reactive form with numerous fields including dropdowns and number inputs. Some of these fields start with empty values while others default to true. Users are allowed to select any combination of fields, making it impossi ...

Changes are made to the Angular template-driven form after certain controls have been added or removed

Within a fieldset, there exists a flexible number of 'select' drop down lists, accompanied by a button after each one (except the last one) to remove it. Upon selecting an option from the last select control, a new select control is dynamically a ...

Optimizing web layouts to fit on a single page is the most effective

Struggling to create a print layout for my web page that seamlessly transitions from the digital realm to the physical world. Utilizing HTML and CSS has presented challenges in aligning the "digital" design with a "real printable" page due to uncertainties ...

Issue with background image not resizing or repeating correctly on mobile devices

My website header is not scaling properly on mobile devices, causing some issues. The background color with white text using Bootstrap and custom CSS is not extending across the screen on smartphones or when viewed in Chrome Dev Tools. As a result, two ma ...

What is the best way to extract values from a specific table column and store them in an array using Angular?

I have a section of code containing a table in my component: expect-next-month.component.html <table id="users"> <tr> <th>Number of month</th> <th>Total checking e ...

Tabindex malfunction in Bootstrap dropdown menu when nested within a form and pressing Enter key

Within my form, I have integrated a Bootstrap 3 dropdown menu situated between two text input fields. The dropdown's role="menu" attribute allows for navigation using the up/down arrow and Enter keys. However, after making a selection in the dropdown ...

Customizing HttpErrorResponse object properties in Angular

I am new to working with Angular (8) and have been developing a frontend SPA that interacts with a Node Express backend API through http calls using the HttpClient module. In the API response, I can define an Http response status along with an additional J ...

The Angular Material Calendar is always designed to highlight the current date and keep focus on today's day

When I click on a date in the Angular Material Calendar, the tile for today's date is always highlighted. This occurs even if the selected date is in a different month. Do you think this behavior is a bug or a feature? I personally believe it is a fe ...

The ngFor directive seems to be malfunctioning as it is only displaying a single element from the object instead of iterating through all of them in Angular version 12

I'm having trouble looping through my array of objects in the UI. Only one element is being displayed. Can anyone help me figure out what I'm doing wrong? Here is my component.html file: <div class="card" *ngFor="let regionList ...

What is the best way to set HTML content in the ElementRef's nativeElement?

I am trying to use a directive to set the content of an HTML element. export class AdvertisementDirective { constructor(el: ElementRef) { el.nativeElement.style.background = 'yellow'; el.nativeElement.content = '<p>Hello Wo ...

Adjusting the height of the v-footer

I'm having trouble adjusting the height of the v-footer component. According to the documentation, I should be able to use the height prop, but when I try height="100px" or height="50%", the footer doesn't change. What could be causing this issue ...

How to bind values to @Directive's @Input properties using Angular Reactive Forms

While working on creating a Reactive Form using the FormBuilder from @angular/forms, I encountered an issue related to custom validating @Directives, @Inputs, and the FormBuilder. In this scenario, I have my own MatchValidator Directive. The question that ...

Tips for Resizing and Reviving Divs with jQuery

I have recently ventured into the world of web development to assist a family member with their website. My knowledge and experience are limited, but I am facing an interesting challenge. I am trying to manipulate certain divs as users scroll down the page ...

What is the best way to ensure that a grid header row stays aligned with the rows that scroll below it

Utilizing the Grid layout feature of bootstrap, I crafted an overview where one row acts as a header that should remain fixed at the top of the grid under all circumstances. The issue arises when the scrollbar appears, causing the layout to shift in a way ...

Guide on how to showcase the template by leveraging the roomList information with ngTemplateOutlet in Angular

TS roomList = [{ name: 'Room2' }] HTML <div class="Layout-body"> <ng-container *ngFor="let dt of roomList; index as i" [ngTemplateOutlet]="Room1" [ngTemplateOutletContext]="{ data: dt, i: i }&qu ...