kivymd/KivyMD

MDDataTable doesn't update pagination picker after `update_row_data()`

Closed this issue · 0 comments

Description of the Bug

Upon invoking update_row_data(instance, data) on MDDataTable, number of pages and records update accordingly when new data gets loaded, but pagination picker (5/10/15 records per page, etc.) is not active and doesn't get updated (take a note how it's stuck at 0 on a screenshot). It doesn't depend on whether I create an empty row on init or initialise the table with empty list of rows. Works fine if 15+ rows is passed when initialising the table.

Code and Logs

from kivy.metrics import dp
from kivymd.uix.stacklayout import StackLayout
from kivy.properties import ObjectProperty
from kivymd.app import MDApp
from kivymd.uix.datatables import MDDataTable


class MainWindow(StackLayout):
    data_tables = ObjectProperty(None)

    def __init__(self):
        super().__init__()
        self.data_tables = MDDataTable(
            size_hint=(1, 0.95),
            use_pagination=True,
            rows_num=7,
            column_data=[("field1", dp(30)), ("field2", dp(30))],
        )
        self.add_widget(self.data_tables)
        # This is done dynamically in my app, for the sake of minimizing the example I wrote it in the init section.
        self.data_tables.update_row_data(
            instance_data_table=self.data_tables, data=[("1", "3"), ("7", "8")])

class App(MDApp):
    controller = ObjectProperty(None)

    def build(self):
        return MainWindow()

App().run()

Screenshots

Screenshot

Versions

  • OS: macOS Monterey 12.3.1
  • Python: 3.9.12
  • Kivy: 2.1.0
  • KivyMD: 1.0.0-dev0