-
FEATURED COMPONENTS
First time here? Check out the FAQ!
I'm attempting to convert a JSF application to ZK. While converting a particular page, I coded:
<?xel-method prefix="myFuncs" name="inStatus" class="com.foo.bar.MyFunctions" signature="java.lang.Boolean inStatus( com.foo.bar.model.EmploymentApplication , java.lang.String )" ?>
...
...
...
<listbox id="applicationList" model="@{myController.employeeApplications}" fixedLayout="true" width="100%" height="100%" vflex="true" >
<listhead sizable="true">
<listheader width="30px" label="Application Date" sort="auto(applicationDate)" />
<listheader width="50px" label="Applicant Name" sort="auto(lastName, firstName)" />
<listheader width="70px" label="Status" sort="auto(status)" />
<listheader width="50px" label="Store #" sort="auto(storeNum)" />
</listhead>
<listitem id="applicationListItem" self="@{each='appl'}" value="@{appl}" forward="onDoubleClick=onEditApplication" >
<listcell ><datebox format="MM/dd/yyyy" value="@{appl.applicationDate}" readonly="true" buttonVisible="false"/> </listcell>
<listcell label="@{appl.lastName}" > , <label value="@{appl.firstName}" /></listcell>
<listcell label="${appl.status}" visible="${ myFuncs:inStatus(appl, 'DECLINED') }" />
<listcell label="@{appl.storeNum}" />
</listitem>
</listbox >
The problem I'm having is in the 3rd <listcell.../>. I want the contents to be visible only if myFuncs:inStatus(...) returns true. Setting a breakpoint in the inStatus method shows that it gets called exactly once. The appl parameter is null. Is there a way to make inStatus(...) get called for each <listitem.../> that is created? Thanks
Chris
@Chris
Try to see this smalltalk (Enrich Your JSF Applications with ZK Today!), I think the tags will not working well
in JSP, you had declared them in a correct way.
About the problem with null parameter, you may write a method in "com.foo.bar.MyFunctions" to print out the response.
If the repsonse is correct, then check the path about <?xel-method class="..." />.
/Joy
@Joy,
Perhaps I wasn't clear about what I am doing. I am working in ZK, not JSF. I had an error in the XEL definition early on and that kept the method from being called at all. Once I corrected the definition, the method does get called, but only once. The real question is, why does the ZK runtime call the method early in its lifecycle instead of when the <listitem /> is rendered.
Chris
Your main problem.
All variable-evaluations
You could use a TypeConverter to extend the databinding with own javacodes.
Check this side for some examples.
/Robert
@Chris
Hmmm...try to use annotation to solve this problem ( Reference:Data_Binding_Collection_Data_with_ZUML_Annotations ).
And there's a method maybe you will use in Composer, "applicationList.invalidate()" could help you refresh this listbox..
Wish these tips are helpful.
/Joy
Asked: 2009-08-23 21:15:52 +0800
Seen: 189 times
Last updated: Aug 25 '09