You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I don't know why my datatable is displayed empty.
I debugged and everything seems to work fine.
Maybe I need to call some refresh? I don't see any method that can do something like this
classLibraryApp(App):
CSS_PATH="styles.tcss"def__init__(self, config_path: str, **kwargs):
super().__init__(**kwargs)
self.config_path=config_pathself.library_manager=Noneself.cache_books= []
defload_config(self):
config=ConfigParser()
config.read(self.config_path)
self.library_path=config.get("Settings", "librarypath", fallback="library.json")
self.library_manager=BibliothecaProcurator(self.library_path)
defcompose(self) ->ComposeResult:
yieldHeader()
yieldStatic(
"📚 **LibraryApp** - Gestione Libri 📖",
id="app_title",
)
withTabbedContent():
withTabPane("Libreria"):
# yield Vertical(# Horizontal(# Input(placeholder="Cerca libri... (minimo 3 caratteri)", id="search_input"),# Button("Cerca", id="search_button", disabled=True),# id="search_container"# ),yieldDataTable(id="output", cursor_type="row", zebra_stripes=True)
# , id="main_container"# )withTabPane("Aggiungi Libro"):
yieldVertical(
Static("Inserisci i dettagli del libro:"),
Input(placeholder="Titolo", id="add_title"),
Input(placeholder="Autore", id="add_author"),
Input(placeholder="Tags (separati da virgola)", id="add_tags"),
Button("Aggiungi", id="submit_add"),
id="add_book_form"
)
yieldFooter()
asyncdefon_mount(self):
self.load_config()
awaitself.view_books()
asyncdefview_books(self):
try:
output_widget=self.query_one("#output", DataTable)
exceptExceptionase:
self.notify("Errore nel recupero della tabella")
returnifnotself.cache_books:
self.cache_books=self.library_manager.get_all_books_sorted_by_date()
# Cancella i dati esistenti nella tabellaoutput_widget.clear()
ifnotself.cache_books:
output_widget.add_columns("Messaggio")
output_widget.add_row("Nessun libro trovato")
return# Aggiungi le colonne alla tabellaoutput_widget.add_columns("Titolo", "Autore", "Aggiunto in data")
# Aggiungi i libri alla tabellaforbookinself.cache_books:
output_widget.add_row(
book["title"],
book["author"],
book["created_at"],
key=book["uuid"])
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I don't know why my datatable is displayed empty.
I debugged and everything seems to work fine.
Maybe I need to call some refresh? I don't see any method that can do something like this
Beta Was this translation helpful? Give feedback.
All reactions