You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by an...@magnasteyr.com on 2005/11/03 16:53:31 UTC

Problems with dynamic datatable

I have a dynamic datatable. In each column there should be a CommandButton. If the user presses this button, that specific row should be deleted.
Therefore I want to pass the ID of this specific row to the Backing Bean.

My problem now is, who can I retrieve the ID, because the datatable is dynamic with t:columns....

Here is my code:
<t:dataTable id="data" 	value="#{dbAdminDto.tableDbAdmindata}" var="row">
	<t:column>
		<h:commandButton image="images/delete.gif" action="#{queryHelper.delete}">
			<h:graphicImage value="images/aendern.gif"/>
			<t:updateActionListener property="#{dtAdminDto.currentId}" value="....."/>  -->WHAT DO WRITE HERE IN THE VALUE????
		</h:commandButton>
	</t:column>
								
	<t:columns value="#{dbAdminDto.columnHeaders}" var="columnHeader">
		<f:facet name="header">
			<h:outputText value="#{columnHeader.label}" />
		</f:facet>
	<h:outputText value="#{dbAdminDto.columnValue}"/>
    </t:columns>
</t:dataTable>

The tableDbAdmindata is a mix of IDs and String values. And I need the dynamic t:columns, because sometimes I have just 2 rows, sometimes 5 rows...

Thx for help!

Regards,
Andy



______________________________________________________________________

This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
your system manager.
 
This footnote also confirms that this email message has been swept
for the presence of computer viruses. 
______________________________________________________________________

Re: Problems with dynamic datatable

Posted by Mike Kienenberger <mk...@gmail.com>.
Hi Andy,

I don't think you need an updateActionListener since you already have
an action and actionLister attribute you can set on your
commandButton.

What you want to do is set the binding attribute on your dataTable to
something like #{queryHelper.dataTable},

then

    public UIData dataTable;

    // provide getter/setter for dataTable

    public String delete()
    {
        YourRowDataType rowData = (YourRowDataType)dataTable.getRowData();

        // delete the rowData.

        return null;
    }


On 11/3/05, andreas.mitter@magnasteyr.com <an...@magnasteyr.com> wrote:
>
>
> I have a dynamic datatable. In each column there should be a CommandButton.
> If the user presses this button, that specific row should be deleted.
>
> Therefore I want to pass the ID of this specific row to the Backing Bean.
>
> My problem now is, who can I retrieve the ID, because the datatable is
> dynamic with t:columns....
>
> Here is my code:
> <t:dataTable id="data"  value="#{dbAdminDto.tableDbAdmindata}" var="row">
>         <t:column>
>                 <h:commandButton image="images/delete.gif"
> action="#{queryHelper.delete}">
>                         <h:graphicImage value="images/aendern.gif"/>
>                         <t:updateActionListener
> property="#{dtAdminDto.currentId}" value="....."/>  -->WHAT DO WRITE HERE IN
> THE VALUE????
>
>                 </h:commandButton>
>         </t:column>
>
>         <t:columns value="#{dbAdminDto.columnHeaders}" var="columnHeader">
>                 <f:facet name="header">
>                         <h:outputText value="#{columnHeader.label}" />
>                 </f:facet>
>         <h:outputText value="#{dbAdminDto.columnValue}"/>
>     </t:columns>
> </t:dataTable>
>
> The tableDbAdmindata is a mix of IDs and String values. And I need the
> dynamic t:columns, because sometimes I have just 2 rows, sometimes 5 rows...
>
> Thx for help!
>
> Regards,
> Andy
>
> ______________________________________________________________________
> This email and any files transmitted with it are confidential and intended
> solely for the use of the individual or entity to whom they are addressed.
> If you have received this email in error please notify your system manager.
> This footnote also confirms that this email message has been swept for the
> presence of computer viruses.
> ______________________________________________________________________
>