justpy icon indicating copy to clipboard operation
justpy copied to clipboard

how to add a `valueFormatter` on the `AgGrid` component ?

Open pabloazurduy opened this issue 3 years ago • 3 comments

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 !

pabloazurduy avatar Apr 30 '21 15:04 pabloazurduy

This seems similar to the issue #261. Will this also be fixed in the next version?

othalan avatar Jul 02 '21 05:07 othalan

Good catch. I will make this change.

elimintz avatar Jul 02 '21 14:07 elimintz

@elimintz has this been done or should be in one of the upcoming milestones?

WolfgangFahl avatar Sep 06 '22 05:09 WolfgangFahl

see #685

WolfgangFahl avatar Sep 20 '23 09:09 WolfgangFahl