Clearing sorting on table columns do not actually clear.
Closed this issue · 1 comments
Describe the bug
I have a table that I want to select some values from. I often use sorting, because it makes it easier to select a row that has a particular value, like a score or some other value.
I've noticed that if I clear the sorting, the tables revert to normal, but if select a row again, the selected row (the .value property of the table) remains as if it's still sorted.
Environment
{
"marimo": "0.9.14",
"OS": "Windows",
"OS Version": "11",
"Processor": "Intel64 Family 6 Model 126 Stepping 5, GenuineIntel",
"Python Version": "3.12.2",
"Binaries": {
"Browser": "129.0.6668.60",
"Node": "v20.14.0"
},
"Dependencies": {
"click": "8.1.7",
"docutils": "0.20.1",
"itsdangerous": "2.2.0",
"jedi": "0.19.1",
"markdown": "3.6",
"narwhals": "1.9.3",
"packaging": "24.0",
"psutil": "5.9.8",
"pygments": "2.17.2",
"pymdown-extensions": "10.7.1",
"pyyaml": "6.0.1",
"ruff": "0.5.2",
"starlette": "0.37.2",
"tomlkit": "0.12.4",
"typing-extensions": "4.12.2",
"uvicorn": "0.29.0",
"websockets": "11.0.3"
},
"Optional Dependencies": {
"pandas": "2.2.2"
}
}
Code to reproduce
A very simple example is this one.
Sort the "data" column by value. For the example use descending. Then select the first row that has the highest value, and observe the table.value is correct. Clear the sorting, and reselect the first row, which now shows 1 in the UI, but observe how the .value is actually 4!
import marimo
__generated_with = "0.9.14"
app = marimo.App(width="medium")
@app.cell
def __():
import marimo as mo
return (mo,)
@app.cell
def __(mo):
table=mo.ui.table([{"data": 1}, {"data": 2}, {"data": 3}, {"data": 4}])
table
return (table,)
@app.cell
def __(table):
table.value
return
if __name__ == "__main__":
app.run()