0

Why JS loaded after doAfterCompose()?

asked 2015-01-13 13:39:43 +0800

love112302 gravatar image love112302
3

Hi all, I am trying customize the Ace Admin Board theme. the "contentPage" which as a Include component will change when user click the navbar.

the code like this

<navitem label="test" iconSclass="z-icon-angle-double-right">
  <attribute name="onClick">
    contentPage.setSrc("../View.zul");
  </attribute>
</navitem>

then, the view.zul is like this

<zk>
  <script type="text/javascript" src="/openlayer/custom/initMap.js"/>
  <vlayout apply="test.EditComposer">
    <div height="600px" width="100%" id="map_canvas" />
  </vlayout></zk>

and the editComposer

public void doAfterCompose(Component comp) throws Exception {
    super.doAfterCompose(comp);

    Clients.evalJavaScript("console.log(\"initMap()\");");
}

the js will log a text like "loaded--JS".

so, which I think the browser console will log like

loaded--JS initMap();

but the browser show like

initMap(); loaded--JS

WHY...? I try every way i can think off. use jq is the same(both document.ready/window load event) any suggestion??

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2015-01-18 21:07:56 +0800

Darksu gravatar image Darksu
1991 1 4

Hello love112302,

Why donn't you make the actual call in the doAfterCompose, instead of calling it in the zul file?

Best Regards,

Darksu

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2015-01-13 13:39:43 +0800

Seen: 11 times

Last updated: Jan 18 '15

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More