Datatable: Sort values vs display values #605
Replies: 3 comments 4 replies
-
Yes, you can. The column definition properties of ag-gird can be set via from pywebio.input import *
from pywebio.output import *
from pywebio.session import *
from pywebio.pin import *
import json
data = [
dict(name=i, price=i)
for i in range(10)
]
put_datatable(
data,
column_args={
"price": {
"valueFormatter": JSFunction("params", "return '£' + params.value;")
}
}
) live demo: https://s.pywebio.online/f5980b79fd56cecde003b6afeb6299a9 |
Beta Was this translation helpful? Give feedback.
-
@wang0618 Thanks, but I wanted to know if we can use a Python function here instead of JS function. |
Beta Was this translation helpful? Give feedback.
-
@wang0618 |
Beta Was this translation helpful? Give feedback.
-
Hi,
After going through the ag-grid documentation I can see that there's already a way to provide sort values and display values differently in a datatable column using value formatters.
Can we achieve this using PywebIO using Python functions to set the display value?
Beta Was this translation helpful? Give feedback.
All reactions