Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
547 views
in Technique[技术] by (71.8m points)

angular - How to force ngx-datatable to resize after Flex wrapper resizes?

I'm using "ngx-datatable" inside my Angular10 app. The app is using flex to layout the usual header, sidebar and data area panels.

I have wrapped the ngx-datatable inside a div that has a flex layout. On opening the app web page, the wrapper div resizes correctly to take up all the available horizontal and vertical space, but the ngx-datatable does not resize to take up all the vertical available space, as shown below

enter image description here

.full-area-grid {
  height: 100% !important;
  width: 99% !important;
}

.eis-vbox {
  height: 100%;
  width: auto;
  box-sizing: border-box;
  display: flex;
  flex: auto;
  flex-direction: column;
  align-items: stretch;
  padding: 0px;
  margin: 0px;
}


<div id="simpleListWrapper" #wrapper class="eis-vbox" >

  <ngx-datatable #simpleListTable id="simpleList"
    class="material striped full-area-grid"
    [rows] = "rows$ | async"
    [columns]="columns"
    [sorts]="sorts"
    [scrollbarV]="true"
    [footerHeight]="50"
    [headerHeight]="50"
    [rowHeight]="40"
    selectionType="checkbox"
    [loadingIndicator]="isloading > 0"
    [scrollbarV]="true"
    [externalPaging]="true"
    [externalSorting]="true"
    [count]="totalRows$ | async"
    [offset]="pageNumber$ | async"
    (page)="setPage($event)"
    (sort)="onSort($event)"
    (select)="onSelect($event)"
  >
  </ngx-datatable>

</div>

Viewing how the web page is displayed, the final resize of the wrapper div takes place AFTER the table has rendered itself and fetched data.

I'm wondering is it possible to capture the resize event on the wrapper div and then somehow force a resize on the table?

Any suggestions?

question from:https://stackoverflow.com/questions/65874382/how-to-force-ngx-datatable-to-resize-after-flex-wrapper-resizes

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...