myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claudio Tasso (JIRA)" <...@myfaces.apache.org>
Subject [jira] Commented: (MYFACES-1010) Extended Data Table: Action Event delivered more than one time
Date Sun, 08 Jan 2006 15:42:21 GMT
    [ http://issues.apache.org/jira/browse/MYFACES-1010?page=comments#action_12362127 ] 

Claudio Tasso commented on MYFACES-1010:
----------------------------------------

Ok, I suppose that I found the problem.
This is the SUN RI  UIData.getClientId() method:

public String getClientId(FacesContext context) {

        if (context == null) {
            throw new NullPointerException();
        }
	String baseClientId = super.getClientId(context);
        if (rowIndex >= 0) {
            return (baseClientId + NamingContainer.SEPARATOR_CHAR + rowIndex);
        } else {
            return (baseClientId);
        }
    }

As you can see, the rowIndex is checked. 
But  org.apache.myfaces.component.html.ext.HtmlDataTableHack.setRowIndex(int rowIndex) does
NOT call

super.setRowIndex(rowIndex)

so the rowIndex property of UIData is always -1 and the client ID is not calculated according
to the current row.
As a final result, the generated  html page does not contain the proper ids.

Adding "super.setRowIndex(rowIndex)" at the beginning of HtmlDataTableHack.setRowIndex() solve
this problem.



> Extended Data Table: Action Event delivered more than one time
> --------------------------------------------------------------
>
>          Key: MYFACES-1010
>          URL: http://issues.apache.org/jira/browse/MYFACES-1010
>      Project: MyFaces
>         Type: Bug
>   Components: Tomahawk (RI Compatability)
>     Versions: 1.1.1
>  Environment: Apache Tomcat 5.5.12 or OC4j 10.1.3 DP4, Win Xp, Sun  RI 1.1.01 , JDK 1.5
>     Reporter: Claudio Tasso

>
> Hi,
> I'm trying using Tomahawk t:dataTable and it seems to me that its behaviour is very different
from the standard  JSF h:dataTable.
> Consider a column which contains a command button and a table with two rows. When the
user clicks on the button of the first row, two action events are generated!
> For example, look at this very simple code:
> <f:view>
>    <h:form>
>        <h:dataTable value="#{testBean.persons}" var="item" binding="#{testBean.uiData}">
>            <h:column>
>                <h:commandButton value="Test" action="#{testBean.test}"></h:commandButton>
>            </h:column>
>            <h:column>
>                <h:outputText value="#{item.name}"></h:outputText>
>            </h:column>
>            <h:column>
>                <h:outputText value="#{item.surname}"></h:outputText>
>            </h:column>
>        </h:dataTable>
>              <t:dataTable value="#{testBean.persons}" var="item" binding="#{testBean.htmlDataTable}"
preserveDataModel="false">
>            <t:column>
>                <h:commandButton value="Test" action="#{testBean.test2}"></h:commandButton>
>            </t:column>
>            <t:column>
>                <h:outputText value="#{item.name}"></h:outputText>
>            </t:column>
>            <t:column>
>                <h:outputText value="#{item.surname}"></h:outputText>
>            </t:column>
>        </t:dataTable>
>    </h:form>
> </f:view>
> When the user clicks the "Test" button of the h:dataTable, the "testBean.test" method
is executed just one time.
> But when the user clicks the "Test" button of the t:dataTable the "testBean.test2" method
is executed twice ( or three times if the table has 3 rows, and so on...).
> I suppose  that the problem is that the elements of  t:dataTable which belongs to differnt
rows have the same ID, and during the processDecode phase the same event is broadcasted more
than one time.
> In fact, this is the html code which is generated by Tomahawk extended datatable:
> <table>
> <tbody id="_id0:_id8:tbody_element">
> <tr>
> <td><input type="submit" name="_id0:_id8:_id10" value="Test" /></td>
> <td>John</td>
> <td>Smith</td>
> </tr>
> <tr><td><input type="submit" name="_id0:_id8:_id10" value="Test" /></td>
> <td>Mark</td>
> <td>Greene</td>
> </tr></tbody>
> </table>
> and this is the html code which is generated by RI h:dataTable:
> <table>
> <tbody>
> <tr>
> <td><input type="submit" name="_id0:_id1:0:_id3" value="Test" /></td>
> <td>John</td>
> <td>Smith</td>
> </tr>
> <tr>
> <td><input type="submit" name="_id0:_id1:1:_id3" value="Test" /></td>
> <td>Mark</td>
> <td>Greene</td>
> </tr>
> </tbody>
> </table>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message