widgetti / widgetti/ipyvuetify

ipyvuetify breaks ipyevents

Open
#216 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
355
Forks
61
PR merge metrics
No merged PRs in 30d

Description

I would like to use ipyevents with ipyvuetify to implement this behavior : Issue 215

But it seems that ipyevents is not compatible with ipyvuetify. I wrote the minimal example;

import ipyvuetify as v
import ipywidgets as ipw
import random
from ipyevents import Event

headers = [
    {'text': 'A', 'value': 'A'},
    {'text': 'B', 'value': 'B'}
]

items = [
    {'A': 0,'B': 9},
    {'A': 1,'B': 1},
    {'A': 2,'B': 5},
    {'A': 3,'B': 19},
    {'A': 4,'B': 11},
    {'A': 5,'B': 15}
]

class EventDataTable(v.DataTable):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        
        self.click_event = Event(source=self, watched_events=['click'])
        self.click_event.on_dom_event(self._on_table_click)
        
    def _on_table_click(self, event):
        rand = random.randint(0, len(self.items) - 1)
        self.v_model = self.items[rand:rand+1]
        
table = EventDataTable(items=items, headers=headers, show_select=True, item_key='A', v_model = [])
table
# v.Content(children = [table])

here it works like a charm, if you click on the table a random row is selected

but then if I put the table inside an ipyvuetify object it does'nt work anymore ex:

v.Content(children = [table])

For info, I tried to use an ipywidget Box and it works

Is it a bug or I missed something ?
Thanks,

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the minimal EventDataTable example in the issue and compare its behavior when rendered directly, inside v.Content, and inside an ipywidgets Box. Trace why the ipyevents click callback stops working when nested in v.Content; done means selecting a random row still works in the nested ipyvuetify case.

Written by the indexing model from the issue text.

Assessment

Tech stack
jupyter, python
Domain
frontend, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.