Datatable: Sort values vs display values #605
amks1
started this conversation in
Feature request
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 |
1 reply
|
@wang0618 Thanks, but I wanted to know if we can use a Python function here instead of JS function. |
2 replies
|
@wang0618 |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
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?
All reactions