You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Cosma Colanicchia <co...@gmail.com> on 2006/06/07 14:38:12 UTC

Re: tomahawk

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 <jo...@devotionmedia.com>:
>
> 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="#{
> ctReportdatahandler.dummy}" onclick="barcodeHistory('#{bl.ctBarcode}')"
> 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"
> onclick="barcodeHistory('CT00468873');clear__5Fid26();document.forms['_id26'].elements['autoScroll'].value=getScrolling();"
> class="Button" /></td></tr>
> <tr class="AltRows1"><td class="standardTable_Column"><input id*
> ="_id26:data:_id29*" name="_id26:data:_id29" type="submit" value="h"
> onclick="barcodeHistory('CT00468877');clear__5Fid26();document.forms['_id26'].elements['autoScroll'].value=getScrolling();"
> 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
> D E V O T I O N <http://www.devotionmedia.com>
> ---------------------
> 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 . . .
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>