justpy
justpy copied to clipboard
how to add a `valueFormatter` on the `AgGrid` component ?
Hi, I was reading the AgGrid documentation About Value formaters
Is there a way to use that formater/define it inside justpy ? This is my example:
import justpy as jp
grid_options = {
#'rowHeight': 40,
'columnDefs': [
{'headerName': "Make", 'field': "make"},
{'headerName': "Model", 'field': "model"},
{'headerName': "Price",
'field': "price",
'cellStyle': {'--tw-border-opacity': 1,
'border-color': 'rgba(96, 165, 250, var(--tw-border-opacity))',
'border-width': '2px',
'border-radius': '0.25rem',
#'valueFormatter': how to add it ?
}
},
],
'rowData': [
{'make': "Toyota", 'model': "Celica", 'price': '0.25' },
{'make': "Ford", 'model': "Mondeo", 'price': '0.24234324234235234' }
],
}
def grid_test():
wp = jp.WebPage(tailwind=True)
grid = jp.AgGrid(a=wp, options=grid_options, theme='ag-theme-material')
grid.html_columns = [2]
for col_def in grid.options.columnDefs:
col_def.editable = True
#col_def.cellStyle = ['rounded','border-2','border-red-500']
return wp
app = jp.app
jp.justpy(grid_test, start_server=False)
Thanks in advance !
This seems similar to the issue #261. Will this also be fixed in the next version?
Good catch. I will make this change.
@elimintz has this been done or should be in one of the upcoming milestones?
see #685