Search code examples
pythonkivykivy-languagekivymd

how to create RecycleView on This data table in kivy python?


i have a data table that contains a 50 rows and i need to display all rows in the page but when click check box that check all the app is crashed until i make a Recycle View on The row_data how can i make this?

from kivy.metrics import dp
from kivy.uix.anchorlayout import AnchorLayout

from kivymd.app import MDApp
from kivymd.uix.datatables import MDDataTable


class Example(MDApp):
    def build(self):
        layout = AnchorLayout()
        data_tables = MDDataTable(
            size_hint=(0.9, 0.6),
            background_color=(1,.1,1,1),
            check=True,
            rows_num = 50,
            column_data=[
                ("No.", dp(30)),
                ("Column 1", dp(30)),
                ("Column 2", dp(30)),
                ("Column 3", dp(30)),
                ("Column 4", dp(30)),
                ("Column 5", dp(30)),
            ],
            row_data=[
                (f"{i + 1}", "1", "2", "3", "4", "5") for i in range(50)
            ],
        )
        layout.add_widget(data_tables)
        return layout


Example().run()


Solution

  • i fixed it the problem was that when increase rows_num more than 10 the application was crashed the fix was to replace the kivymd from pypi module to github kivymd module and it will fix all the module problems