Added event handling support to VisNetwork and enhanced component documentation
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
from myfasthtml.controls.Panel import Panel
|
||||
from myfasthtml.controls.VisNetwork import VisNetwork
|
||||
from myfasthtml.core.commands import LambdaCommand
|
||||
from myfasthtml.core.instances import SingleInstance, InstancesManager
|
||||
from myfasthtml.core.network_utils import from_parent_child_list
|
||||
|
||||
@@ -11,7 +12,8 @@ class InstancesDebugger(SingleInstance):
|
||||
|
||||
def render(self):
|
||||
nodes, edges = self._get_nodes_and_edges()
|
||||
vis_network = VisNetwork(self, nodes=nodes, edges=edges, _id="-vis")
|
||||
c = LambdaCommand(lambda event_data: print("received", event_data))
|
||||
vis_network = VisNetwork(self, nodes=nodes, edges=edges, _id="-vis", events_handlers={"select_node": c})
|
||||
return self._panel.set_main(vis_network)
|
||||
|
||||
def _get_nodes_and_edges(self):
|
||||
|
||||
Reference in New Issue
Block a user