Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MDDataTable doesn't update pagination picker after update_row_data() #1242

Closed
FallenChromium opened this issue May 7, 2022 · 0 comments
Closed

Comments

@FallenChromium
Copy link

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant