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

✨ Add meta data to trigger via components. #228

Open
T4rk1n opened this issue Oct 27, 2021 · 0 comments
Open

✨ Add meta data to trigger via components. #228

T4rk1n opened this issue Oct 27, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@T4rk1n
Copy link
Owner

T4rk1n commented Oct 27, 2021

Add a binding_meta keyword to Python Component to store extra information to be sent to the backend with the bindings trigger.

from dazzler.system import Page, BindingContext, Trigger
from dazzler.components import core

page = Page(
    __name__,
    core.Container([
       core.Button(
           f'click {i}',
           identity=f'btn{i}',
           binding_meta={'meta': 'info', 'index': i}
       ) for i in range(3)
    ])
)


@page.bind(
    Trigger(
        aspect='clicks',
        identity='btn',
        regex=True,
    )
)
async def on_clicks(ctx: BindingContext):
    print(ctx.trigger.meta['index'])
@T4rk1n T4rk1n added the enhancement New feature or request label Oct 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant