如何更改 ag-grid (JavaScript) 侧边栏的宽度?
How to change ag-grid (JavaScript) sidebar's width?
我需要将 ag-grid 侧边栏的宽度默认更改为 1000px。请检查配置和图像。谢谢
const listingGridOptions = {
columnDefs: listingColumnDefs,
icons: {
'custom-stats': '<span class="ag-icon ag-icon-custom-stats"></span>'
},
sideBar: {
maxWidth:600,
toolPanels: [
{
id: 'columns',
labelDefault: 'Columns',
labelKey: 'columns',
iconKey: 'columns',
toolPanel: 'agColumnsToolPanel',
},
{
id: 'filters',
labelDefault: 'Filters',
labelKey: 'filters',
iconKey: 'filter',
toolPanel: 'agFiltersToolPanel',
},
{
id: 'customStats',
labelDefault: 'Custom Stats',
labelKey: 'customStats',
iconKey: 'custom-stats',
toolPanel: 'customStatsToolPanel',
},
],
//defaultToolPanel: 'customStats'
},
components: {
imageRenderer: imageRenderer,
customStatsToolPanel: CustomStatsToolPanel
},
defaultColDef: {
flex: 1,
minWidth: 150,
filter: true,
resizable: true,
sortable: true,
enableRowGroup: true,
floatingFilter: true
},
rowSelection: 'single',
autoGroupColumnDef: {
minWidth: 200
},
rowGroupPanelShow: 'always',
onSelectionChanged: onSelectionChanged,
// use the server-side row model
rowModelType: 'serverSide',
serverSideStoreType: 'full',
animateRows: true,
};
用 css 覆盖工具面板宽度并将宽度设置为 1000px
,如下所示:
.ag-tool-panel-wrapper {
width: 1000px !important;
}
Demo.
我需要将 ag-grid 侧边栏的宽度默认更改为 1000px。请检查配置和图像。谢谢
const listingGridOptions = {
columnDefs: listingColumnDefs,
icons: {
'custom-stats': '<span class="ag-icon ag-icon-custom-stats"></span>'
},
sideBar: {
maxWidth:600,
toolPanels: [
{
id: 'columns',
labelDefault: 'Columns',
labelKey: 'columns',
iconKey: 'columns',
toolPanel: 'agColumnsToolPanel',
},
{
id: 'filters',
labelDefault: 'Filters',
labelKey: 'filters',
iconKey: 'filter',
toolPanel: 'agFiltersToolPanel',
},
{
id: 'customStats',
labelDefault: 'Custom Stats',
labelKey: 'customStats',
iconKey: 'custom-stats',
toolPanel: 'customStatsToolPanel',
},
],
//defaultToolPanel: 'customStats'
},
components: {
imageRenderer: imageRenderer,
customStatsToolPanel: CustomStatsToolPanel
},
defaultColDef: {
flex: 1,
minWidth: 150,
filter: true,
resizable: true,
sortable: true,
enableRowGroup: true,
floatingFilter: true
},
rowSelection: 'single',
autoGroupColumnDef: {
minWidth: 200
},
rowGroupPanelShow: 'always',
onSelectionChanged: onSelectionChanged,
// use the server-side row model
rowModelType: 'serverSide',
serverSideStoreType: 'full',
animateRows: true,
};
用 css 覆盖工具面板宽度并将宽度设置为 1000px
,如下所示:
.ag-tool-panel-wrapper {
width: 1000px !important;
}
Demo.