-
FEATURED COMPONENTS
First time here? Check out the FAQ!
hey,
and yet another problem.
i'm using javascript in my zul file:
<script type="text/JavaScript"> <![CDATA[ function init() { var data = '${mapView$composer.data}'.evalJSON(); for (var key in data) { if (data.hasOwnProperty(key)) { alert(key); } } } ]]> </script>
the problem is as follows:
in my composer i have a method getData:
//this work fine if i hardcode the objects public JSONArray getData(){ JSONArray a = new JSONArray(); a.push("m3"); a.push("m4"); return a; }
now i want to do the following:
MyWindow container = (MyWindow) comp.getParent(); public JSONArray getData(){ //this won't work because javascript calls the method before the page is composed, therefore container = null; JSONArray a = new JSONArray(); List<String> list = new ArrayList<String>(); list = container.getList(); for(String str : list){ a.push(str); } return a; }
how can i solve this, i have to access the getList() methode from my window.
thanks.
Why are you doing all this AJAX by hand? If you're going to use ZK, let it do it for you. Hook the doBeforeCompose(...) method of your composer and set an attribute that has your list as the value.
Asked: 2011-06-15 15:43:48 +0800
Seen: 361 times
Last updated: Jun 15 '11