Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set Formatter for Column Definitions #369

Open
hshiravi opened this issue Nov 23, 2021 · 0 comments
Open

Set Formatter for Column Definitions #369

hshiravi opened this issue Nov 23, 2021 · 0 comments

Comments

@hshiravi
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant