I have been going round in circles trying to apply ngx-perfect-scrollbar to ag-grid. I can get both working separately, but I want to completely replace the default scrollbar on my datatable with perfect-scrollbar.
I have set up my module as per their instructions:
import { PerfectScrollbarModule } from 'ngx-perfect-scrollbar';
import { PerfectScrollbarConfigInterface } from 'ngx-perfect-scrollbar';
const PERFECT_SCROLLBAR_CONFIG: PerfectScrollbarConfigInterface = {
suppressScrollX: true
};
@NgModule({
declarations: [
],
imports: [
PerfectScrollbarModule.forRoot(PERFECT_SCROLLBAR_CONFIG)
]
})
and in my template:
<perfect-scrollbar class="psc">
<ag-grid-angular #agGrid style="width:100%;height:100%" class="ag-dark"
[gridOptions]="gridOptions"
[rowData]="rowData">
</ag-grid-angular>
</perfect-scrollbar>
This simply results in the outer element appearing with the new custom scrollbar, containing the datagrid with the standard toolbar. I need to apply both directives to the same element I guess, but I'm lost as to how to do this.
I was also trying this approach, using the standard (non-angular) perfect-scrollbar package, and trying to bind it to the correct .ag-body-viewport
element when the component is loaded:
import perfectScrollbar from 'perfectScrollbar';
this.viewport = this.$element.find('.ag-body-viewport')[0];
perfectScrollbar.initialize(this.viewport);
but I can't get it to work either; I just get the "no default export" error...
Any pointers appreciated. Thanks