myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leonardo Uribe <lu4...@gmail.com>
Subject Re: Trouble getting the value of a value expression in a datatable
Date Mon, 21 Jun 2010 00:02:48 GMT
Hi

That is because the fields that are saved per row (but not between request)
are the ones related to EditableValueHolder interface. Take a look at the
implementation of UIData. In this case "value" property goes per row but
"param" is shared by all rows.

This is a problem described on:

https://issues.apache.org/jira/browse/MYFACES-2616
Fix UIData state saving model (spec issue 153)

Really, there is not an easy solution for this issue. After thinking a lot
in this issue I think we can create a custom datatable component that has
this problem fixed, instead try to fix UIData implementation, because that
could cause compatibility problems (I'm not investigated too much that
suposition).

regards,

Leonardo Uribe

2010/6/20 Ali Ok <aliok@aliok.com.tr>

> Hi,
>
> I am having problems with getting the value of an expression within a
> datatable with my custom component.
>
> Let me write the code:
> <h:dataTable value="#{dndBean.teams}" var="team">
>  <h:column>
> <hx:div>
> <fx:dragSource action="move" param="#{team.id}" /> <!-- evaluates to empty
> string -->
>  <h:outputText value="#{team.id}" />   <!-- renders the correct id -->
> </hx:div>
>  </h:column>
> </h:dataTable>
>
> dndBean: managed bean
> dndBean.teams: List<SportsTeam>, where SportsTeam has a public String
> getId() method
> team: var of datatable
>
> I am getting a value of empty string for #{team.id} in the facelet handler
> of fx:dragSource, if I put the fx:dragSource in a h:dataTable.
> In the apply method of handler, I am trying to get the value as
> _param.getValue(faceletContext)  //use this method since deferredValueType
> of _param is String
>
> where _param is
> @JSFFaceletAttribute(name = "param", className =
> "javax.el.ValueExpression", deferredValueType = "java.lang.String")
> private final TagAttribute _param;
>
> If I put the fx:dragSource somewhere else, I am getting the correct value
> at the handler:
> <h:form>
> <hx:div>
>  <fx:dragSource action="move" param="#{lakers.id}" />
>  </hx:div>
> </h:form>
>
> Why can this be happening?
>
> One more hint, for the first case if I try to get the value at the handler,
> I get empty string.
> If I pass the value expression to behavior, and try to get the value at
> renderer using the value expression, I am getting the correct value.
>
> In theory, if the second case works, so does first one; right? Or am I
> missing something?
>
> Thanks,
> Ali
>
> --
> My Blog: http://blog.aliok.com.tr
> Twitter: http://twitter.com/aliok_tr
>
>

Mime
View raw message