-
-
Notifications
You must be signed in to change notification settings - Fork 695
Open
Description
Description of the Bug
Hi kivy team, the sort_on method does not work for the first column, but works for all other columns.
The arrow does not show like in other columns
Code and Logs
from kivy.metrics import dp
from kivymd.app import MDApp
from kivymd.uix.datatables import MDDataTable
from kivymd.uix.screen import MDScreen
class BugInMDDataTable(MDApp):
def build(self):
self.data_tables = MDDataTable(
column_data=[
("Title", dp(30), self.sort_on_title),
("Brand", dp(30), self.sort_on_brand),
],
row_data=[
(
"item F",
"brand 1",
),
(
"item A",
"brand 2",
),
(
"item D",
"brand 3",
)
],
sorted_on="Title",
sorted_order="ASC",
elevation=2)
screen = MDScreen()
screen.add_widget(self.data_tables)
return screen
def sort_on_title(self, data):
return zip(*sorted(enumerate(data), key=lambda l: l[1][0]))
def sort_on_brand(self, data):
return zip(*sorted(enumerate(data), key=lambda l: l[1][1]))
BugInMDDataTable().run()
Versions
- OS: Windows 10
- Python: 3.11
- Kivy: 2.2.1
- KivyMD: 1.2.0
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels