Replies: 2 comments 1 reply
-
|
To update a component from JS, looks dirty but works: async function updateComponent(findName) {
let element = document.querySelector('[hydro-name="'+findName+'"]');
await window.Hydro.hydroAction(element , window.Hydro.findComponent(element), { name: "Mount"});
}You can replace "Mount" with your action name if you want to trigger a specific code when updating. Would say we need a simple method for that like I saw a similar question somewhere, how to update a component from another component when they do not have a parent-child relation and cannot share events. My latest use case: a data edition dialog would need to refresh the items list after one item was edited-saved, components are completely separate. |
Beta Was this translation helpful? Give feedback.
-
|
Fixed |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a case where depending on browser window size I need to render different content, CSS won't help here. So actually I used Alpine, while haven't found some neat way to do it using pure Hydro:
Would prefer something more clean.. While we do not have browser events coming from Hydro yet (do we?) could call component action from
windowWidthHandlerso that it would set some internal component property likebool IsWideScreen {get; set;}and build UI from there..Looking into
hydroAction(el, component, action), any hints?Beta Was this translation helpful? Give feedback.
All reactions