I am using Ionic 3/Anuglar 5 am trying to setup a floating horizontal scroll bar for a very tall table in a component . I have come across this solution which should work nicely. Floating horizontal scroll bar for html table
http://jsfiddle.net/cowboy/45rEs/show/
The issue I have is I don't know how to or exactly where to implement the following code into my component:
$('.your-div').floatingScrollbar();
So far I have imported the js plugin into my index:
<script src="assets/jquery.ba-floatingscrollbar.min.js"></script>
I just don't know what to do in my component?
import { Component } from '@angular/core';
@Component({
selector: 'tall-table',
templateUrl: 'tall-table.html'
})
export class TallTableComponent {
constructor() {
}
/*
** name: Ng On Init
** desc:
*/
ngOnInit(): void {
}
/*
** name: Destroy
** desc: Unsubscribe
*/
ngOnDestroy(): void {
}
}
tall-table.html
<div id="horz-scroll-wrapper" style="width: 300px; overflow: scroll">
<div style="height: 100%;">
<table class='sample'>
<tbody>
<tr *ngFor="let row of [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]">
<td >abcdefghijklmnopqrstuvwxyz</td><td >ABCDEFGHIJKLMNOPQRSTUVWXYZ</td><td >1234567890</td><td >0987654321</td><td >abcdefghijklmnopqrstuvwxyz</td><td >ABCDEFGHIJKLMNOPQRSTUVWXYZ</td><td >1234567890</td><td >0987654321</td>
</tr>
</tbody>
</table>
</div>
</div>
ngAfterViewInit()method.