0

I have a issue to make a infinity loading with data table. I have check some solution. But only for window, not for data table. Please help me how to check bottom or top if a user has scrolled to the bottom of data table. Tks for your helped!

<div class="card" *ngIf="!idCondition">
        <div class="card-body">
          <table class="table cus-table">
            <thead>
              <tr style="color:#4e73df; ">
                <th scope="col" >Col A</th>
                <th scope="col" >Col B</th>
                <th scope="col" >Col C</th>
                <th scope="col" >Col D</th>
                <th scope="col" >Col E</th>
                <th scope="col" >Col F</th>
                <th scope="col" >Col G</th>
              </tr>
            </thead>
            <tbody>
              <tr *ngFor="let searchResult of searchResults; let i = index" (click)="goToResultDetail(i)">
                <td title="{{getSystemStatus(searchResult.systemStatus)}}">{{getSystemStatus(searchResult.systemStatus)}}</td>
                <td title="{{searchResult.birthday}}">{{searchResult.birthday}}</td>
                <td title="{{getGender(searchResult.gender)}}">{{getGender(searchResult.gender)}}</td>
                <td title="{{searchResult.receiptType}}">{{searchResult.receiptType}}</td>
                <td title="{{searchResult.receiptManagementNo}}">{{searchResult.receiptManagementNo}}</td>
                <td title="{{searchResult.medicalInstitutionName}}">{{searchResult.medicalInstitutionName}}</td>
                <td title="{{searchResult.treatmentYearMonth}}">{{searchResult.treatmentYearMonth}}</td>
              </tr>
            </tbody>
          </table>
        </div>
      </div>
Thanh Nguyen
  • 308
  • 3
  • 12
  • `@HostListener('window:scroll', ['$event']) onWindowScroll(event) { // 200 is the height from bottom from where you want to trigger the infintie scroll, can we zero to detect bottom of window if ((document.body.clientHeight + window.scrollY + 200) >= document.body.scrollHeight) { console.log('bottom'); } }` – Thanh Nguyen Sep 16 '20 at 04:03
  • I tried this code. but it is active for page. not table ! – Thanh Nguyen Sep 16 '20 at 04:04
  • Answered here: https://stackoverflow.com/questions/55419779 – trusktr Feb 11 '22 at 20:10
  • Does this answer your question? [Check if a user has scrolled to the bottom in subpixel precision era](https://stackoverflow.com/questions/55419779/check-if-a-user-has-scrolled-to-the-bottom-in-subpixel-precision-era) – trusktr Feb 11 '22 at 20:11

0 Answers0