Flex mode allows for responsive row details in ngx-datatable

Having an issue with my ngx datatable row details. Everything works well initially, but when I adjust the browser width, the details don't scale properly with rows and columns. They seem to have a fixed width that was set when the page was first loaded. Any suggestions on how to fix this?

https://i.stack.imgur.com/UJaoq.png

https://i.stack.imgur.com/VSMvj.png

https://i.stack.imgur.com/JjVpd.png

 <ngx-datatable
    #myTable
    class="material"
    [columnMode]="'flex'"
    [headerHeight]="50"
    [footerHeight]="50"
    [rowHeight]="'auto'"
    [rows]="details">
    <ngx-datatable-row-detail [rowHeight]="100" #myDetailRow (toggle)="onDetailToggle($event)" flex>
      <ng-template let-row="row" let-expanded="expanded" ngx-datatable-row-detail-template >
        <div style="padding-left:35px;">
          <div><strong>Address Address Address Address Address AddressAddressAddress Address Address Address Address Address</strong></div>
        </div>
      </ng-template>
    </ngx-datatable-row-detail>
    <ngx-datatable-column name="Name" [flexGrow]="1">
      <ng-template let-row="row" let-expanded="expanded" ngx-datatable-cell-template>
          <a
          [class.datatable-icon-right]="!expanded"
          [class.datatable-icon-down]="expanded"
          title="Expand/Collapse Row"
          (click)="toggleExpandRow(row)">aaa
        </a>
      </ng-template>
    </ngx-datatable-column>
    <ngx-datatable-column name="Name" [flexGrow]="1">
      <ng-template let-row="row" ngx-datatable-cell-template>
        testing 3
      </ng-template>
    </ngx-datatable-column>
    <ngx-datatable-column name="Gender" [flexGrow]="5">
      <ng-template let-row="row" let-value="value" ngx-datatable-cell-template>
        testing
      </ng-template>
    </ngx-datatable-column>
    <ngx-datatable-column name="Age" [flexGrow]="5">
      <ng-template let-row="row" ngx-datatable-cell-template>
        testingsecond
      </ng-template>
    </ngx-datatable-column>
  </ngx-datatable>

Answer №1

:host ::ng-deep .ngx-datatable .datatable-body .datatable-scroll {
  visibility: visible;
}

effective in this scenario

Answer №2

Describing the process in a .ts file

import { ColumnMode } from '@swimlane/ngx-datatable';
ColumnMode = ColumnMode; (property)

Demonstrating the setup in a .html file

<ngx-datatable [rows]="(courses$ | async).items" [count]="(courses$ | async).totalCount"
    [loadingIndicator]="loading" [list]="list" [sorts]="[{ prop: 'creationTime', dir: 'desc' }]"
    [columnMode]="ColumnMode.flex"
    [messages]="{emptyMessage: '::DisplayName:NoDataAvailable' | abpLocalization, totalMessage: '::DisplayName:Total' | abpLocalization}"
    default>
    <ngx-datatable-column [flexGrow]="3" [name]="'::DisplayName:Name' | abpLocalization" prop="name">
    </ngx-datatable-column>
    <ngx-datatable-column [flexGrow]="1" [name]="'::Courses:Type' | abpLocalization" prop="type">
        <ng-template let-data="row" ngx-datatable-cell-template>
            {{'::DisplayName:' + courseType[data.type] | abpLocalization}}
        </ng-template>
    </ngx-datatable-column>
    <ngx-datatable-column [flexGrow]="1" [name]="'::DisplayName:Status' | abpLocalization" prop="status">
        <ng-template let-data="row" ngx-datatable-cell-template>
            {{'::DisplayName:' + coursePublishStatus[data.status] | abpLocalization}}
        </ng-template>
    </ngx-datatable-column>
    <ngx-datatable-column [flexGrow]="1" [name]="'::DisplayName:CreatedOn' | abpLocalization" prop="creationTime">
        <ng-template let-data="row" ngx-datatable-cell-template>
            <div [ngbTooltip]="data.creationTime | date: 'medium'" placement="top-start" container="body">
                {{data.creationTime | amTimeAgo }}</div>
        </ng-template>
    </ngx-datatable-column>
    <ngx-datatable-column [flexGrow]="1" [sortable]="false" [name]="'::DisplayName:Actions' | abpLocalization">
        <ng-template let-column="column" ngx-datatable-header-template>
            {{column.name}}
        </ngx-datatable-column>
    </ngx-datatable>

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

Is it true that Angular 16 does not have compatibility with the ng search filter feature?

Is it true that Angular 16 does not support the ng search filter? I encountered an error when trying to implement it, saying "the library (ng2-search-filter) which declares Ng2SearchPipeModule is not compatible with Angular Ivy". Looking for suggestions o ...

Adjusting the width of the container <div> will automatically resize the inner <div> to match

I have a main container element. .wrapper{ border:1px solid blue; position:relative; top:20%; left:30%; height: 300px; width: 350px; } When I adjust the width of the parent container, the child box does not reposition itself accor ...

Enabling and disabling links in a Bootstrap dropdown menu with dynamic functionality on click

One interesting feature of bootstrap is that it allows users to disable links within its dropdown menu component by simply adding a class="disabled" into the corresponding <li> tag. I am looking to create some Javascript code so that when a user sel ...

The transition effect of changing opacity from 0 to 1 is not functioning properly in Firefox

Having some trouble with this animation not working in Firefox. I'm triggering the animation using JavaScript after a delay like so: document.getElementById('my_id').style.webkitAnimationPlayState = "running"; I've also attempted: s ...

Is it possible to disable a function by clicking on it?

I currently have a website that is utilizing the following plugin: This plugin enables an image to be zoomed in and out through CSS transforms, with default controls for zooming in and out. My goal is to incorporate a reset button that returns the image ...

Insert between the top navigation bar and the sidebar menu

I am currently in the process of designing my very first website and I have encountered a bit of trouble. I would like to add a page between a navbar and a vertical bar, and I want this page to be displayed when a button on the vertical bar is clicked. You ...

Aligning an element in the middle of an image vertically

Trying to vertically center a div inside an image element has been challenging. While there are many ways to achieve vertical centering in general, this specific case presents unique difficulties. To accomplish this, the following minimum code is needed: ...

Incorporating dual CSS stylesheets into a single HTML document

I have been utilizing jsonform from https://github.com/joshfire/jsonform to create forms based on a json schema. However, jsonform requires its own css for the form, while I prefer to use a different css for my website's template. Is there a method t ...

How can I use Angular to download the HTML content of a component when a button is clicked?

Is there a way to generate and download an HTML report directly from a dialog box in Angular 13.2.5 without redirecting the user to a separate page? The dialog box collects user input, and I want a button labeled "Generate" at the bottom of the dialog box ...

How can I add information into a nested div element?

I encountered an issue when attempting to insert data into my block. The div structure is as follows: <div class="1"> <div class="2"> <div class="3"> <div class="4"></div> </div> ...

Guidelines for transitioning an AngularJS module for injection into an Angular 2 component

After diving into the Angular 2 upgrade guide and successfully setting up a hybrid app (combining ng1 as a base code with components and services gradually transitioning to ng2), I've hit a snag. How do I incorporate 3rd party ng1 modules so that Angu ...

Tips for including a permanent button at the bottom of a material ui dialog box

I want to implement a dialog popup in my react js application. When the user clicks on a button, the dialog should open up. Inside the dialog, there is a form with input fields. After the user fills out all the inputs, they can submit the information by cl ...

Difficulty arises when attempting to load Silverlight within an Angular2 component

Issue with Silverlight Component Loading When embedding and loading the Silverlight.xap file directly inside an HTML page, everything works perfectly. However, when we move the same code inside a component, the Silverlight content fails to load. Interest ...

Complications arising from IE when using strict doctype with CSS and jQuery

Here's the code I'm using for a sliding caption effect on my gallery site: I specifically implemented the last effect which is the Caption Sliding (Partially Hidden to Visible). $('.boxgrid.caption').hover(function(){ $(".cover", th ...

It's possible for anyone to enhance the appearance of the Download button by adding styles without compromising its functionality

Looking to enhance the style of the Download button as it appears too formal. Seeking assistance in adding some button styles to make it more stylish. The code is correct, just aiming to give the Download button a trendy look with specified styles. ...

Issue with PrimeNG Calendar month picker functionality not functioning as expected

I recently integrated a PrimeNG code snippet for a month picker. Although it is functioning correctly, I noticed a discrepancy compared to the PrimeNG example - specifically, the year does not change when clicking on the arrow buttons. The ngModel, howev ...

What could be causing the data I'm trying to show in Angular to be present but not visible on the screen?

UPDATE: After a suggestion from @Mathias in the comments, it appears that the *ngIf statement causing the issue is as follows: (*ngIf="currentUsername == chat.senderUsername else elseBlock1") I'm puzzled as to why this isn't working, since bot ...

Creating time input forms that are responsive can be achieved by leveraging the features of Bootstrap

Currently, I am working on a Laravel project and I am facing an issue with making a form responsive. I have added the following viewport meta tag, but I have not seen any changes. Any suggestions on how to make this form responsive would be greatly appreci ...

Retrieving a FirebaseObjectObservable child in Angularfire2 is straightforward

Can you target a specific child of a FirebaseObjectObservable in Angular? Take a look at RcTestAppComponent.save() function below for commented lines. Here is an example: https://github.com/angular/angularfire2/blob/master/docs/3-retrieving-data-as-lists. ...

CSS clearfix restricted to immediate parent div

Below is the code snippet that illustrates the objective I am attempting to achieve <div> <div style="float:left; width:220px; height:300px; border: 1px solid #aaa"> Left div <br>float:left <br> fixed width 220px </div> ...