On upgrade ag-grid version 19 from version 9, on right click tool panel option is not coming

岁酱吖の 提交于 2019-12-11 11:05:33

问题


On upgrade ag-grid version 19 from version 9, on right click tool panel option is not coming. Also we have an icon on click we opened a tool Panel for pivot that too is not working.

This is the current code we have on click of it.

This worked well for ag-Grid 9 but not working for ag-Grid 19

this.preferencesService.togglePivot.subscribe(() => {
    const isOpen = this.gridOptions.api.isToolPanelShowing();
    if (isOpen) {
        this.gridOptions.columnApi.setColumnState(this.saveGridState);
        this.gridOptions.api.showToolPanel(false);
        this.gridOptions.api.setSideBarVisible(false);
        this.gridOptions.columnApi.setPivotMode(false);
        // this.sideBar = false;
    } else {
        this.saveGridState = this.gridOptions.columnApi.getColumnState();
        this.gridOptions.api.showToolPanel(true);
        this.gridOptions.api.setSideBarVisible(true);
        // this.sideBar = 'columns';
        this.gridOptions.columnApi.setPivotMode(true);
    }
});

回答1:


You need to set [sideBar]="true" for the toolbar to display.

Check this updated plunk

Reference: Boolean Configuration


Update:

I tried many combinations to make it closed by default setting some parameter. Anyways, you could achieve it by using gridApi. Check the plunk, I have updated it.

onGridReady(params) {
  this.gridApi = params.api;
  this.gridApi.closeToolPanel();
}



回答2:


Here's the details about sideBar/toolPanel configuration.

sideBar can be more than just true or false.




回答3:


setSideBarVisible did not work properly for me, instead I've got toggle method which sets and unsets the sidebar as below

toggleSideBar(): void {
    this.gridOptions.api.setSideBar(this.gridOptions.api.getSideBar() ? null : this.sideBar());
}


来源:https://stackoverflow.com/questions/52967180/on-upgrade-ag-grid-version-19-from-version-9-on-right-click-tool-panel-option-i

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!