-
-
Notifications
You must be signed in to change notification settings - Fork 584
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
Log viewer inside tabs issue #1869
Comments
Wow, thanks for reporting this issue, @marcin-koziol! It seems like the Right now I'm not sure how to fix it. When calling |
maybe we could add the ability to bind a variable to the log (same as for inputs), so we'll be able to push logs to this var , without having rendered component? Is the truncating logic implemented only on the client? |
Yes, the truncating logic is implemented on the client. But more importantly, we don't want to send the whole log of maybe thousands of lines to the client every time a new line is pushed. Instead we only want to send an incremental update. Therefore I'd like to avoid any fix or workaround involving |
I still have no idea how to fix this issue. Therefore I'll remove the milestone for now. |
We have spotted a similar problem with AG Grids: with ui.tabs().classes('w-full') as tabs:
one = ui.tab('One')
two = ui.tab('Two')
with ui.tab_panels(tabs, value=one).classes('w-full'):
with ui.tab_panel(one):
async def get_data():
ui.notify(await grid.get_client_data())
ui.button('Get data', on_click=get_data)
with ui.tab_panel(two):
grid = ui.aggrid({
'columnDefs': [{'headerName': 'Name', 'field': 'name'}],
'rowData': [{'name': 'Alice'}, {'name': 'Bob'}],
}) Like with |
Hi, just wondering, what is the best strategy for an workaround? , if you want multiple logs updating on multiple views? (for example on seperate pages, on multiple tabs, etc.) |
@E-H-E-H It shouldn't be a problem on separate pages. For the issue with But wait! Maybe we can re-implement import time
from typing import Optional
from nicegui import ui
ui.add_head_html('<style>.custom-log .q-scrollarea__content { padding: 0.25rem; gap: 0; }</style>')
class Log(ui.scroll_area):
def __init__(self, max_lines: Optional[int] = None) -> None:
super().__init__()
self.classes('custom-log font-mono whitespace-pre-wrap bg-gray-50 border border-gray-200')
self.max_lines = max_lines
def push(self, text: str) -> None:
with self:
ui.label(text)
while self.max_lines is not None and len(self.default_slot.children) > self.max_lines:
self.remove(0)
self.scroll_to(percent=100)
log = Log(max_lines=20)
log.push('Hello, world!')
log.push('Hello, world!') |
I see that you made a new implementation of the ui.log(). Great! thanks a lot! :) |
I have just run into the AG Grid issue - I have multiple grids on multiple tabs. Is there any similar work around now (or in the pipeline) for grids? |
Description
I want to place the Log component in the tab, everything is OK, but to see the logs, you first need to switch to the Log viewer tab
In this example:
The text was updated successfully, but these errors were encountered: