You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Alexander Traeder <al...@wt-concept.org> on 2005/12/05 22:54:07 UTC

datatable - problems with commandlink

Hi,

tried this for some days:
t->tomahawk (myfaces-1.1.1 and nightly build)
                <t:dataTable var="row" value="#{test.data}" 
rowIndexVar="rowIndex" preserveDataModel="true"
                             rows="10" rendered="true">
                    <h:column>
                           <f:facet name="header">
                                <h:outputText value="Test Col 1" />
                           </f:facet>   
                           <t:commandLink action="success" 
immediate="true" >               
                                <h:outputText value="#{row[0]}" />
                                <t:updateActionListener 
property="#{test.selectedRow}" value="#{row[0]}" />
                        </t:commandLink>
                    </h:column>
                    <h:column>
                           <f:facet name="header">
                                <h:outputText value="Test Col 2" />
                           </f:facet>                   
                        <h:outputText  value="#{row[1]}" />
                    </h:column>    
                </t:dataTable>
                <t:dataScroller ...>

The purpose is to detect a row item is selected.
While debugging the setSelectedRow-method is called for every row - not 
only the selected one!
If I try this with <h:dataTable> it works.
what I detected on the client side is that the id for <t:dataTable> is 
not filled right:

... id="test:testform:test_datatable:_id21" ...
... id="test:testform:test_datatable:_id21" ...
... id="test:testform:test_datatable:_id21" ...

for <h:dataTable> it is:

... id="test:testform:test_datatable:0:_id21" ...
... id="test:testform:test_datatable:1:_id21" ...
... id="test:testform:test_datatable:2:_id21" ...


Am I doing something wrong or is this a bug?

Thanks Alex

Re: datatable - problems with commandlink

Posted by Simon Kitching <sk...@obsidium.com>.
Alexander Traeder wrote:
> Hi,
> 
> tried this for some days:
> t->tomahawk (myfaces-1.1.1 and nightly build)
>                <t:dataTable var="row" value="#{test.data}" 
> rowIndexVar="rowIndex" preserveDataModel="true"
>                             rows="10" rendered="true">
>                    <h:column>
>                           <f:facet name="header">
>                                <h:outputText value="Test Col 1" />
>                           </f:facet>                             
> <t:commandLink action="success" immediate="true" >               
>                                <h:outputText value="#{row[0]}" />
>                                <t:updateActionListener 
> property="#{test.selectedRow}" value="#{row[0]}" />
>                        </t:commandLink>
>                    </h:column>
>                    <h:column>
>                           <f:facet name="header">
>                                <h:outputText value="Test Col 2" />
>                           </f:facet>                   
>                        <h:outputText  value="#{row[1]}" />
>                    </h:column>                   </t:dataTable>
>                <t:dataScroller ...>
> 
> The purpose is to detect a row item is selected.
> While debugging the setSelectedRow-method is called for every row - not 
> only the selected one!
> If I try this with <h:dataTable> it works.
> what I detected on the client side is that the id for <t:dataTable> is 
> not filled right:
> 
> ... id="test:testform:test_datatable:_id21" ...
> ... id="test:testform:test_datatable:_id21" ...
> ... id="test:testform:test_datatable:_id21" ...
> 
> for <h:dataTable> it is:
> 
> ... id="test:testform:test_datatable:0:_id21" ...
> ... id="test:testform:test_datatable:1:_id21" ...
> ... id="test:testform:test_datatable:2:_id21" ...
> 
> 
> Am I doing something wrong or is this a bug?

I don't know what might be causing your problem. I'm using a SVN build 
from about 4 days ago, and I see this for ids in a table when viewing 
the source in a browser:
    body:searchForm:theGrid_0:rowSelector
    body:searchForm:theGrid_1:rowSelector
    body:searchForm:theGrid_2:rowSelector

It looks to me like your "id" output is instead from logging the 
component's id somehow...how exactly did you get this output?

I haven't seen any commits to UIData that might have broken it in the 
last few days.

Regards,

Simon