column sortable option must fallback to True
https://github.com/robotools/vanilla/blob/3ef4eba6dca0a94d14eef6da343524fd601f387d/Lib/vanilla/vanillaList2.py#L656
now it falls back to None
Should it fall back to True or False? It was off by default in List because back when vanilla used Cocoa Bindings sorting was quite difficult and in some instances would modify the represented data. I don't know if we should preserve the off-by-default setting or not.
thanks for looking into it. it would be nice if it could behave just like vanilla.List, falling back to whatever value is set in the parent allowsSorting argument:
import ezui
import vanilla
myTableItems = [
dict(name="A", value=8),
dict(name="X", value=9),
dict(name="B", value=2),
dict(name="D", value=7),
dict(name="Z", value=3),
]
class DemoTable(ezui.WindowController):
def build(self):
content = """
|------|-------|
| name | value | @myTable
|------|-------|
"""
descriptionData = dict(
myTable=dict(
items=myTableItems,
allowsSorting=True,
columnDescriptions=[
dict(
identifier="name",
title="name",
),
dict(
identifier="value",
title="value",
),
],
),
)
self.w = ezui.EZWindow(
title="ezui Table",
size=(300, 200),
content=content,
descriptionData=descriptionData,
controller=self
)
def started(self):
self.w.open()
class DemoList2:
def __init__(self):
self.w = vanilla.Window((300, 200), title='vanilla List2')
self.w.list = vanilla.List2(
(10, 10, -10, -10),
items=myTableItems,
allowsSorting=True,
columnDescriptions=[
dict(
identifier="name",
title="name",
),
dict(
identifier="value",
title="value",
),
],
)
self.w.open()
class DemoList:
def __init__(self):
self.w = vanilla.Window((300, 200), title='vanilla List')
self.w.list = vanilla.List(
(10, 10, -10, -10),
myTableItems,
allowsSorting=True,
columnDescriptions=[
dict(
identifier="name",
title="name",
),
dict(
identifier="value",
title="value",
),
],
)
self.w.open()
DemoTable()
DemoList2()
DemoList()
the documentation mentioned the fallback should be True and this follows the old vanilla List behaviour.
https://github.com/robotools/vanilla/blob/3ef4eba6dca0a94d14eef6da343524fd601f387d/Lib/vanilla/vanillaList2.py#L397-L400
A vanillaList2 has support to disable specific columns not to be sorted even if the global allowsSorting is True.
Was there any update on this? There are some EZUI-based tools that I think would be greatly enhanced with the ability to sort table results. Thanks!