webtier@glassfish.java.net

Problem with rowClasses probably caused by changes from 1.2_09 to 1.2_11

From: <webtier_at_javadesktop.org>
Date: Wed, 14 Jan 2009 03:20:51 PST

Hello,

I'm developing an application using JSF (Mojarra) and Facelets. I had some code written that display some h:dataTable with different styles for odd and even rows using the rowClasses attribute.

I think it was after I updated my libraries from 1.2_09 to 1.2_11 that the code stopped working. When I check the generated html for a table with several rows, it has only odd class styles.

After some debugging I noticed that there is a problem with the counter for the rows. My opinion is that creating a TableMetaInfo for each row (each with its own rowStyleCounter) is the reason why there is no switching between styles. It's always the first one that is used. The code for creating the meta info is as follows:

protected TableRenderer.TableMetaInfo getMetaInfo(FacesContext context,
                                                      UIComponent table) {

        String key = createKey(context, table);
        Map<String,Object> reqMap = context.getExternalContext().getRequestMap();
        TableRenderer.TableMetaInfo info = (TableRenderer.TableMetaInfo)
              reqMap.get(key);
        if (info == null) {
            info = new TableRenderer.TableMetaInfo(table);
            reqMap.put(key, info);
        }
        return info;

    }

The key that is generated is something like mainForm:table:0, mainForm:table:1, etc.

The code is different from 1.2_09 where you'll find:

protected TableRenderer.TableMetaInfo getMetaInfo(UIComponent table) {

        TableRenderer.TableMetaInfo info = (TableRenderer.TableMetaInfo)
              table.getAttributes().get(TableRenderer.TableMetaInfo.KEY);
        if (info == null) {
            info = new TableRenderer.TableMetaInfo(table);
            table.getAttributes().put(TableRenderer.TableMetaInfo.KEY, info);
        }
        return info;

    }

And don't want to get to any more details as I'm not sure what exactly went wrong. Is there anyone that knows something about the issue. I couldn't find anything on Google or the other forums so any suggestions are welcome.

Thank you for the attention,
Alex
[Message sent by forum member 'wise_guybg' (wise_guybg)]

http://forums.java.net/jive/thread.jspa?messageID=325934