AG Grid: Custom sorting based on a list

I see, so is it not possible directly using a comparator?
I ask because I was testing this in a dummy example but in my actual app I have 3 columns where I want to do a custom sort.
I noticed you had previously suggested a solution for a custom sort here but I couldn’t build on it

Additionally, if my ranks are my only choice, how do I implement it?
I don’t want to show the rank columns in my actualy view o I went witgh a solution like this but it still shows the rows in alphabetical sport order and not my custom order

"""
app.py – Dash-AG-Grid example with a hidden numeric rank column
that forces a custom order of category groups.

Run:  python app.py
"""

import json
import dash
from dash import html
import dash_ag_grid as dag
import pandas as pd

SPORT_ORDER = ["Swimming", "Gymnastics", "Speed Skating"]
RANK = {sport: rank for rank, sport in enumerate(SPORT_ORDER)}

df = pd.DataFrame(
    {
        "athlete": [
            "Michael Phelps", "Aleksey Nemov", "Cindy Klassen",
            "Nastia Liukin", "test", "test2"
        ],
        "sport": [
            "Swimming", "Speed Skating", "Gymnastics",
            "Gymnastics", "Swimming", "Swimming"
        ],
        "gold": [8, 2, 1, 1, 2, 3],
    }
)

df["sport_rank"] = df["sport"].map(RANK).fillna(99).astype(int)

column_defs = [
    {
        "field":    "sport_rank",
        "hide":     True,
        "sortable": True,
        "sort":     "asc",     
    },
    {
        "field":    "sport",
        "rowGroup": True,
        "hide":     True,
    },
    {"field": "athlete", "minWidth": 150},
    {"field": "gold",    "aggFunc": "sum", "width": 90},
]

# Definition for the visible auto-group column
auto_group_def = {
    "headerName": "Sport",
    "cellRenderer": "agGroupCellRenderer",
    "cellRendererParams": {"suppressCount": True},
}

app = dash.Dash(__name__)

app.layout = html.Div(
    dag.AgGrid(
        rowData=df.to_dict("records"),
        columnDefs=column_defs,
        defaultColDef={"resizable": True, "filter": True},
        dashGridOptions={
            "groupDisplayType": "singleColumn",
            "rowGroupPanelShow": "always",
            "autoGroupColumnDef": auto_group_def,
        },
        enableEnterpriseModules=True,
        dangerously_allow_code=True,
        style={"height": 400, "width": 600},
    )
)


if __name__ == "__main__":
    app.run_server(debug=True)