With t:dataTable, you should use forceIdIndexFormula="#{yourBeanVar.primaryKeyColumn}" to tell which column use as the row index (tableId:rowIndex:controlId).

Normally, if you don't specify one, sequential indexes are generated. This can lead to out-of-sync problem if someone else deletes of insert some records while the dataTable is displayed. Don't know why yours is fixed to "data".. you have set a lot of forceIdIndex, forceId, indexVar etc... try to start from scratch with only the forceIdIndexFormula one.


Cosma



2006/6/7, Joel Wilson <[EMAIL PROTECTED]>:
You need to have the action that is being called be on the object in the list not in the backing bean. I use that technique with a custom dataSource i created for Hibernate.

On Jun 6, 2006, at 3:32 PM, Michael H. Chang wrote:

I am using tomahawk dataTable and dataScroller tags to display results retrieved from database. For each row, I would like to have a button that will edit a value associated with that particular row. But the JSF gave all rows on the page same id, when I press one button, every row was fired off. Any suggestion is highly appreciated.

Here is my code:

<t:dataTable id="data" styleClass="TabForegroundColor" headerClass="standardTable_Header" footerClass="standardTable_Header"
rowClasses="AltRows1, AltRows2"
columnClasses="standardTable_Column,standardTable_ColumnCentered,standardTable_Column"
var="bl" value="#{ctReportdatahandler.ctReportModel}"
rows="#{ctReportdatahandler.noOfRows }"
rowIndexVar="index"
forceId="true" forceIdIndex="true"
sortColumn="#{ctReportdatahandler.sort}"
sortAscending="#{ctReportdatahandler.ascending}" preserveSort="true">
<t:column>
<f:facet name="header">
<h:outputText value="" />
</f:facet>
<h:commandButton value="h" actionListener="{ctReportdatahandler.historyCtBarcodes }" action="" styleClass="Button" /> </t:column>

Incorrect source:

<tr class="AltRows1"><td class="standardTable_Column"><input id ="_id26:data:_id29" name="_id26:data:_id29" type="submit" value="h" class="Button" /></td></tr>
<tr class="AltRows1"><td class="standardTable_Column"><input id="_id26:data:_id29" name="_id26:data:_id29" type="submit" value="h" class="Button" /></td></tr>


Both buttons are _id26:data:_id29, I expect the first row _id26:data0:_id29 and 2nd row _id26:data1:_id29 so if I press button for row 0, row1 button won't get fired off.



Michael H. Chang
2-1148


Joel Wilson
Web Application Developer/Architect
---------------------
Skype: Jesfrk7
Skype: 321.285.7470

Cell: 321.332.4654
Office: 407.677.8514
Fax: 407.677.8610
---------------------
1964 Howell Branch Road
Suite 102
Winter Park, Florida 32792
---------------------
Changing the world, one byte at a time . . .





















Reply via email to