myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Marinschek" <martin.marinsc...@gmail.com>
Subject Re: Using t:dataList with Ajax4JSF
Date Fri, 11 Apr 2008 08:28:25 GMT
Hi Matt,

attention - your fix will not always work as expected. What you
effectively do is you evaluate the value-binding once, and then set
the retrieved value locally. So the value-binding will only be
evaluated on the _first_ request. You should also override the getters
and setters, and do the normal JSF stuff in them.

regards,

Martin

On 4/10/08, Matt.Rossner-prest@sanofi-aventis.com
<Matt.Rossner-prest@sanofi-aventis.com> wrote:
> Fix if anyone's interested :
>
>
>
> public class HtmlDataList extends
> org.apache.myfaces.custom.datalist.HtmlDataList {
>
>     public Object saveState(FacesContext context) {
>
>         Object [] values = new Object[2];
>
>         values[0] = super.saveState(context);
>
>         values[1] = getItemStyleClass();
>
>         return values;
>
>     }
>
>
>
>     public void restoreState(FacesContext context, Object state) {
>
>         Object [] values = (Object[])state;
>
>         super.restoreState(context, values[0]);
>
>         setItemStyleClass((String)values[1]);
>
>     }
>
> }
>
>
>
> Then just override it in your config file :
>
>
>
> <component>
>
>   <component-type>org.apache.myfaces.HtmlDataList</component-type>
>
>
> <component-class>com.sag.ibee.web.gui.component.datalist.HtmlDataList</component-class>
>
>
> </component>
>
>
>
> Just tested and it works fine for me.
>
> ________________________________
>
> De : Matt.Rossner-prest@sanofi-aventis.com
> [mailto:Matt.Rossner-prest@sanofi-aventis.com]
> Envoyé : jeudi 10 avril 2008 15:35
> À : users@myfaces.apache.org
> Objet : RE: Using t:dataList with Ajax4JSF
>
>
>
> Ok I found the problem already, this would appear to be a bug with Tomahawk
> (as I have the source attached here). Looks like "itemStyleClass"  was
> omitted from the saveState method. When I was debugging this I noticed the
> value for it was null.
>
>
>
> Listing from HtmlDataList.java
>
>
>
> public Object saveState(FacesContext context)
>
> {
>
>     Object values[] = new Object[17];
>
>     values[0] = super.saveState(context);
>
>     values[1] = _layout;
>
>     values[2] = _rowIndexVar;
>
>     values[3] = _rowCountVar;
>
>     values[4] = _onclick;
>
>     values[5] = _ondblclick;
>
>     values[6] = _onkeydown;
>
>     values[7] = _onkeypress;
>
>     values[8] = _onkeyup;
>
>     values[9] = _onmousedown;
>
>     values[10] = _onmousemove;
>
>     values[11] = _onmouseout;
>
>     values[12] = _onmouseover;
>
>     values[13] = _onmouseup;
>
>     values[14] = _style;
>
>     values[15] = _styleClass;
>
>     values[16] = _title;
>
>     return values;
>
> }
>
>
>
> As you can see itemStyleClass is not there. I'm using MyFaces 1.1.5, not
> sure if this problem exists in 1.2 but we're not upgrading at this point. I
> guess for now I'll just override this component to make it work. I'll see
> about opening a proper bug maybe? I haven't done so before so I'm not sure
> what the process is for that.
>
>
>
> ________________________________
>
> De : Matt.Rossner-prest@sanofi-aventis.com
> [mailto:Matt.Rossner-prest@sanofi-aventis.com]
> Envoyé : jeudi 10 avril 2008 15:23
> À : users@myfaces.apache.org
> Objet : Using t:dataList with Ajax4JSF
>
>
>
> Hi,
>
>
>
> I have a small problem with t:dataList and Ajax4JSF. I'm going to step
> through this in the debugger soon but maybe someone's already encountered
> this.
>
>
>
> I have a t:dataList like so:
>
>
>
> <t:dataList id="dataList" var="element" value="#{mbDataList.folderList}"
> layout="unorderedList" styleClass="DataList" itemStyleClass="DataList">
>
>
>
> Elsewhere I'm doing some Ajax4JSF action and I pass "dataList" to be
> rerendered.
>
>
>
> For the most part it rerenders correctly except it seems to omit the
> 'itemStyleClass="DataList"' attribute. The data gets updated, but the
> formatting gets broken since the <li>s don't have their class attribute
> anymore.
>
>
>
> Thanks,
>
> Matt
>
>


-- 

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces

Mime
View raw message