setExpandNode in treeView

Forum to discuss the new web client version of Servoy.

setExpandNode in treeView

Postby rieder » Wed Apr 06, 2022 11:28 am

Hi

onShow of a form we load a dataset into a treeView (servoy-extra component). Then we call setExpandNode and receive the warning
WARN com.servoy.j2db.server.ngclient.api - You are calling a component sync api method (to browser) in form 'XY' before the form is available in browser's DOM. This should be avoided.


Is there a hook, where we can call setExpandNode? A hook after the form is available in the DOM? Like 'afterAvailable'?

Thanks and regards
Birgit
Birgit Rieder
7r AG, Switzerland
SAN Developer
http://www.seven-r.ch
User avatar
rieder
 
Posts: 177
Joined: Thu Jan 26, 2012 5:18 pm

Re: setExpandNode in treeView

Postby mboegem » Wed Apr 06, 2022 1:34 pm

Hi Birgit,

Some components like treeView and dataGrid do have an onReady eventhandler.
onReady will be triggered as soon as the full DOM is ready.

Hope this helps.
Marc Boegem
Solutiative / JBS Group, Partner
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance Developer

Image

Partner of Tower - The most powerful Git client for Mac and Windows
User avatar
mboegem
 
Posts: 1742
Joined: Sun Oct 14, 2007 1:34 pm
Location: Amsterdam

Re: setExpandNode in treeView

Postby rieder » Wed Apr 06, 2022 2:24 pm

Hi Marc

Thank you for the answer. I actually did try with onReady, but the event is triggered continuously, not just once. Do you know, how I can unregister the event, if it got triggered the first time?

Best regards
Birgit
Birgit Rieder
7r AG, Switzerland
SAN Developer
http://www.seven-r.ch
User avatar
rieder
 
Posts: 177
Joined: Thu Jan 26, 2012 5:18 pm

Re: setExpandNode in treeView

Postby mboegem » Wed Apr 06, 2022 2:57 pm

The onReady should only be triggered once.
If it's triggered continuously, there might be something else that is causing that behaviour.

So: no, I don't know how to unregister, as this should not be necessary.
Marc Boegem
Solutiative / JBS Group, Partner
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance Developer

Image

Partner of Tower - The most powerful Git client for Mac and Windows
User avatar
mboegem
 
Posts: 1742
Joined: Sun Oct 14, 2007 1:34 pm
Location: Amsterdam

Re: setExpandNode in treeView

Postby rieder » Wed Apr 06, 2022 3:29 pm

Hi Marc

Thank you for the hint with onReady. Good to know, that it should work.
I'll simplify my form and check, if triggering stops. To figure out what fires the event.

Thanks and kind regards
Birgit
Birgit Rieder
7r AG, Switzerland
SAN Developer
http://www.seven-r.ch
User avatar
rieder
 
Posts: 177
Joined: Thu Jan 26, 2012 5:18 pm

Re: setExpandNode in treeView

Postby robert.edelmann » Wed Apr 06, 2022 6:44 pm

if everything else fails, a form-variable that you check in the function and set after running the first time could help.
mit freundlichen Grüßen
Robert Stefan Edelmann
User avatar
robert.edelmann
 
Posts: 91
Joined: Wed Aug 14, 2013 6:12 pm


Return to Servoy NGClient

Who is online

Users browsing this forum: No registered users and 10 guests