-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi I have some code that can be used to update the screen when I click on a grid.
<grid id="summaryGrid" model="@{winTwSignals$composer.trainwireClassEventsList, load-after='timeRangeCombo.onChange, dateTimeBox.onChange'}"
style="width:800px; height:235px; overflow:auto">
<attribute name="onClick">
do stuff to update the screen
</attribute>
What code do I need to update the screen once the grid has loaded. (I need to do this because it has to do with bing maps, I need to manipulate a bing maps javasript object, unfortunately)
I have tried
<attribute name="onMove">
and onFocus
onLoad -everything. Can anyone make any suggestions? I want to update the sceen once it has loaded using javascript but without clicking (onclick).
Thanks
James
Thanks guys, much appreciated! The "onInitRender" event did the trick.
I spent time reading though documentation, e.g. here:
http://www.zkoss.org/javadoc/2.2.0/zk/org/zkoss/zk/ui/event/Events.html
and I did not find this "onInitRender" event documented. I now realise that I needed to look at the components methods, e.g.
The XUL Components Components Listbox
Live and learn.
Anyway, this has fixed my problem, much appreciated and long live open source! (We'll be buying more support soon by the way).
Cheers,
James
Hi
another idea, use onInitRender
<?page title="new page title" contentType="text/html;charset=UTF-8"?> <zk> <zscript><![CDATA[ List ary = new ArrayList(); ary.add("1"); ListModelList model = new ListModelList(ary); ListitemRenderer re = new ListitemRenderer() { public void render(Listitem item, Object data) throws Exception { item.appendChild(new Listcell(obj.toString)); } }; ]]></zscript> <grid id="grid" model="${model}"> <attribute name="onInitRender"> List l = model.getInnerList(); for (Object obj : l) { System.out.println(obj.toString()); } </attribute> </grid> <button label="Add model" onClick='model.add("2")'></button> </zk>
Some ideas:
1.) Manage the databinding inside the composer:
Instead of load-after='timeRangeCombo.onChange, dateTimeBox.onChange'
you have to catch
onChange$timeRangeCombo
onChange$dateTimeBox
binder.loadAll(); // fill the grid
Clients.eval...
2.) Create a dummy field (behind the grid)
<label id="updateMapDummy" visible="false" value="@{winTwSignals$composer.updateMap, load-after='timeRangeCombo.onChange, dateTimeBox.onChange'}"/>
public String updateMap() {
Clients.eval....
return null;
}
3.) Timer event (wait for 500 ms) and update onTimer
/Robert
P.S. the full code in the attribute block is:
<attribute name="onClick">
winTwSignals$composer.setMapParameters(true);
jsonMapPins = gen.getPointsArrayJson();
jsonMapDetails = gen.getMapDetailsJson();
Clients.evalJavaScript("removePins();");
Clients.evalJavaScript("setupMap(" + jsonMapPins + ");");
</attribute>
Can anyone help?
Just to repeat, I need a replacement for "onClick" that doesn't require clicking - but works automatically, rather like an onload type event.
Asked: 2010-08-24 11:26:07 +0800
Seen: 719 times
Last updated: Aug 25 '10