Skip to content

Set Formatter for Column Definitions #369

Open
@hshiravi

Description

@hshiravi

Trying to set a custom formatter when defining a column as specified here throws an error:

def customFormatter(row, cell, value, columnDef, dataContext):
  return value

col_def = {
    'A':{  'width': 50, 'formatter': customFormatter
    }
}

df = pd.DataFrame(np.random.random([5, 4]), columns =["A", "B", "C", "D"]) 
qgrid_widget = qgrid.show_grid(df, column_definitions=col_def)

This throws the following error:
ValueError: Can't clean for JSON: <function customFormatter at 0x7f2cd4b5ec10>

How is one expected to set a custom formatter for a column?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions