1
votes

I am using a Customer Ag Grid Cell Render to show dropdown in ag grid. It is found the last row cannot show the full dropdown while the first row can show the full dropdown.

The class .ag-cell have dropdown list visible within the cell/row. But It seems that the grid have style of overflow: hidden.

example-render.component.ts


@Component({
  selector: 'app-example-render',
  templateUrl: './example-render.component.html',
  styleUrls: ['./example-render.component.less']
})
export class ExampleRenderComponent implements ICellRendererAngularComp  

  agInit(params: any): void {
    this.value = params.value;
  }

  refresh(params: any): boolean {
    return false;
  }

}

example-render.component.html

<div class="btn-group" dropdown>
    <button id="button-basic" dropdownToggle type="button" class="btn btn-primary dropdown-toggle"
            aria-controls="dropdown-basic">
      Button dropdown <span class="caret"></span>
    </button>
    <ul id="dropdown-basic" *dropdownMenu class="dropdown-menu"
        role="menu" aria-labelledby="button-basic">
      <li role="menuitem"><a class="dropdown-item" href="#">Action</a></li>
      <li role="menuitem"><a class="dropdown-item" href="#">Another action</a></li>
      <li role="menuitem"><a class="dropdown-item" href="#">Something else here</a></li>
      <li class="divider dropdown-divider"></li>
      <li role="menuitem"><a class="dropdown-item" href="#">Separated link</a>
      </li>
    </ul>
  </div>

app.component.ts

import { ExampleRenderComponent } from './example-render/example-render.component';
import { Component } from '@angular/core';
import { GridOptions } from 'ag-grid-community';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.less']
})
export class AppComponent {

  title = 'app';

  columnDefs = [
      {headerName: 'Col1', field: 'col1'},
      {headerName: 'Col2', field: 'col2'},
      {headerName: 'Col3', field: 'col3', 
        cellRendererFramework: ExampleRenderComponent,
        cellStyle: { "overflow": 'visible' }
      }
  ];

  rowData = [
      { col1: 'Data 11', col2: 'Data 12', col3: 'Data 13' },
      { col1: 'Data 21', col2: 'Data 22', col3: 'Data 23' },
      { col1: 'Data 31', col2: 'Data 32', col3: 'Data 33' }
  ];

  gridOptions: GridOptions = <GridOptions> {
    rowHeight: 100
  }
}

app.component.html

<div>
    <ag-grid-angular 
      style="width: 1000px; height: 300px;" 
      class="ag-theme-balham"
      [rowData]="rowData" 
      [columnDefs]="columnDefs"
      [gridOptions]="gridOptions">
    </ag-grid-angular>
</div>

app.component.less

/deep/ actions-button-cell {
    overflow:visible; 
}

/deep/ .ag-cell { 
    overflow:visible; 
}

/deep/ .ag-row {
    z-index: 0;
}

/deep/ .ag-row.ag-row-focus {
    z-index: 1;
}


/deep/ .ag-root,
/deep/ .ag-body-viewport,
/deep/ .ag-body-viewport-wrapper {
    overflow: visible !important;
}


enter image description here

enter image description here

stackblitz: https://stackblitz.com/edit/angular-eumtpf

2
a stackblitz will make it easier for us to help...Akber Iqbal
Thanks @AkberIqbal. Attached. stackblitz.com/edit/angular-eumtpfBen Cheng

2 Answers

3
votes

The below fixes the problem

app.component.less

/deep/ actions-button-cell {
    overflow:visible; 
}

/deep/ .ag-cell { 
    overflow:visible; 
}

/deep/ .ag-row {
    z-index: 0;
}

/deep/ .ag-row.ag-row-focus {
    z-index: 1;
}

/deep/ .ag-root,
/deep/ .ag-root-wrapper,
/deep/ .ag-body-viewport,
/deep/ .ag-body-viewport-wrapper, 
/deep/ .ag-center-cols-clipper,
/deep/ .ag-center-cols-viewport {
    overflow: visible !important;
}

enter image description here

0
votes

The control now supports a new way of doing this, negating the need to use lots of cluttersome CSS.

Simply add container="body" to the dropdown directive line:

<div class="btn-group" dropdown container="body">
....
</div>

The rest is done for you. You can get rid of all the /deep/ or :host CSS.

The docs are here: Dropdown append to body