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

Empty space in table nor rendered properly for tags and also causing weird filter behavior #1905

Closed
mturoci opened this issue Mar 27, 2023 · 0 comments · Fixed by #1939
Closed
Assignees
Labels
bug Bug in code ui Related to UI

Comments

@mturoci
Copy link
Collaborator

mturoci commented Mar 27, 2023

via @g-eoj

Wave SDK Version, OS

0.25.2

Actual behavior

image

Expected behavior

If tag value is an empty string, nothing should be rendered. The empty option should also not be present in filters if the table column is filterable.

Steps To Reproduce

# Table / Tags
# Use tags in order to emphasize a specific value. For multiple tags in a single row use `,` as a delimiter.
# ---
from faker import Faker
from h2o_wave import main, app, Q, ui

fake = Faker()

_id = 0


class Issue:
    def __init__(self, text: str, tag: str):
        global _id
        _id += 1
        self.id = f'I{_id}'
        self.text = text
        self.tag = tag


# Create some issues
issues = [Issue(text=fake.sentence(), tag=('' if i % 2 == 0 else 'DONE,SUCCESS')) for i in range(10)]

columns = [
    ui.table_column(name='text', label='Issue', min_width='400px'),
    ui.table_column(name='tag', label='Badge', filterable=True, cell_type=ui.tag_table_cell_type(name='tags', tags=[
        ui.tag(label='FAIL', color='$red'),
        ui.tag(label='DONE', color='#D2E3F8', label_color='#053975'),
        ui.tag(label='SUCCESS', color='$mint'),
    ])),
]


@app('/demo')
async def serve(q: Q):
    q.page['example'] = ui.form_card(box='1 1 -1 -1', items=[
        ui.table(
            name='issues',
            columns=columns,
            rows=[ui.table_row(name=issue.id, cells=[issue.text, issue.tag]) for issue in issues],
        )
    ])
    await q.page.save()
@mturoci mturoci added ui Related to UI bug Bug in code labels Mar 27, 2023
@mturoci mturoci changed the title Empty space in table tags nor rendered properly Empty space in table tags nor rendered properly and also causing weird filter behavior Mar 27, 2023
@mturoci mturoci changed the title Empty space in table tags nor rendered properly and also causing weird filter behavior Empty space in table nor rendered properly for tags and also causing weird filter behavior Mar 27, 2023
marek-mihok added a commit that referenced this issue Apr 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug in code ui Related to UI
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants