ipyvuetify icon indicating copy to clipboard operation
ipyvuetify copied to clipboard

ipyvuetify breaks ipyevents

Open Gabriel-ROBIN opened this issue 3 years ago • 0 comments

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,

Gabriel-ROBIN avatar Mar 22 '22 17:03 Gabriel-ROBIN