Hi,
Are there any ways to change column order without using callback ? I am now using column group function but my column order is shown as wrong way. I would like to show Metrics first and then Name and then BMP. but somehow bmp is position in front of Name.
def getcolDef(df):
df_columnDefs = []
for i in df.columns:
if i == 'METRICS':
df_columnDefs.append({
"headerName":'METRICS/CATEGORY',
"minWidth": 250,
"pinned":"left",
"lockPinned": True,
"showRowGroup": i,
"cellRenderer": 'agGroupCellRenderer',
"cellRendererParams": {
"suppressCount": True},
})
df_columnDefs.append({"headerName": "METRICS/CATEGORY", "field": i, "rowGroup": True, "hide": True,"lockPinned": True,"rowGroupIndex":1})
elif i == 'NAME':
df_columnDefs.append({
"headerName":'NAME',
"minWidth": 300,
"pinned":"left",
"lockPinned": True,
"showRowGroup": i,
"cellRenderer": 'agGroupCellRenderer',
"valueGetter": '(params) => {if (params.data) {return params.data.i;}}',
"cellRendererParams": {
"suppressCount": True},
})
df_columnDefs.append({"headerName": "", "field": i, "rowGroup": True, "hide": True,"lockPinned": True, "rowGroupIndex":2})
elif i == 'AGENCY':
df_columnDefs.append({"headerName": "BMP", "field": i, "minWidth": 250, "pinned":True,})
else:
df_columnDefs.append({"headerName": i, "field": i, "type": 'rightAligned',"valueFormatter": {"function": "Numberformat(params[spoiler]This text will be blurred[/spoiler].value)"}})
return df_columnDefs