Hi,
I decided to replace the h:selectBooleanCheckbox by an html <input
type="checkBox"> tag, just adding ajax behavior with ajax4jsf:
-----------------------------------------------------------------------------------------------------------------------------------
<a4j:commandLink action="#{infoBean.swapSelected}">
<h:panelGroup rendered="#{infoBean.selected && !disabled}">
<input type="checkbox" checked="true" style="width: 15px;"/>
</h:panelGroup>
<h:panelGroup rendered="#{!infoBean.selected && !disabled}">
<input type="checkbox" style="width: 15px;"/>
</h:panelGroup>
<h:panelGroup rendered="#{disabled}">
<input type="checkbox" style="width: 15px;" disabled="true"/>
</h:panelGroup>
<f:param name="selelectedInfoBean" value="#{infoBean.id}" />
</a4j:commandLink>
-----------------------------------------------------------------------------------------------------------------------------------
swapSelected() method just swap boolean value for selected property.
now, of course, there is no more setSelected() Action. but there is an issue
between the clientIds for the commandLink and the binded backingBean (witch
is always the last row one)
with the same exemple:
for this 2 rows structure:
-[]folder1
-[]file1
-[]file2
---------------------------------------------------
-[]folder2
-[]file3
-[]file4
when I select the file1 checkbox, file3BackBean will be bind
when I select the file2 checkbox, file4BackBean will be bind
idfile1: contentForm:contentManagement:_id107:table:0:_id188:0:0:_id243
idfile3: contentForm:contentManagement:_id107:table:1:_id188:0:0:_id243
it seems that the only _id243 is used to bind the backBeen from clientId.
what do you think ?
On 3/19/07, Sébastien LEVER <[EMAIL PROTECTED]> wrote:
Hi All,
does nobody encounter this usecase ?
The wierd things are:
- why childs elements do not call the setSelected method at all ?
- why main elements (folder1, folder2) call several times the setSelected
method ?
does anyone encounter the same problem ? is there something wrong in my
implementation ?
note that the use of selectBooleanCheckbox inside dataTable without tree2works
correctly.
Thanx for any comment.
Sebastien
On 3/9/07, Sébastien LEVER <[EMAIL PROTECTED]> wrote:
>
> My usecase is a dataTable contaning checkedNodes trees.
>
> The checkBoxes events are managed correctly when there is 1 row.
>
> From two rows, problems happened:
>
> for this 2 rows structure:
> -[]folder1
> -[]file1
> -[]file2
> ---------------------------------------------------
> -[]folder2
> -[]file3
> -[]file4
>
> If I check folder1 node, folder 1 is unchecked by backend actions (if
> folder1 is expanded, it expands folder2).
> log:
> folder2.selectedValueChange(), oldValue: false, newValue: true
> folder2.setSelected(true) HAS CHANGED !
> folder2.setSelected(true)
> folder2.setSelected(false) HAS CHANGED !
>
> If I check folder2 node (all folder collapsed), folder 2 is checked by
> backend actions.
> log:
> folder2.selectedValueChange(), oldValue: false, newValue: true
> folder2.setSelected(true) HAS CHANGED !
> folder2.setSelected(false) HAS CHANGED !
> folder2.setSelected(true) HAS CHANGED !
>
> Here is the page structure:
>
> <h:dataTable var="tableItem" id="table" value="#{table.data}"
> preserveDataModel="false" preserveSort="false" sortable="false"
> styleClass="standardTable" headerClass="standardTable_Header"
> footerClass="standardTable_Header"
> rowClasses="standardTable_Row1,standardTable_Row2"
> columnClasses="standardTable_Column,
> standardTable_ColumnCentered, standardTable_Column">
> <ui:param name="sortedCol" value="#{table.sortedColumn}" />
> <t:column defaultSorted="true" >
> <f:facet name="header">
> <h:outputText value="#{ bundle.tableColumnName}"
> />
> </f:facet>
> <h:panelGroup rendered="#{tableItem.type=='folder'
> && tableItem.node.childs}">
> <t: tree2 value="#{ tableItem.node}"
> var="subnode"
> showLines="false" >
> <f:facet name="folder">
> <h:panelGroup>
> <h:selectBooleanCheckbox
> id="_check"
> value="#{
> subnode.infoBean.selected}"
>
> valueChangeListener="#{subnode.infoBean.selectedValueChange }"
> onclick="
> this.form.submit()"/>
> <h:outputText value="#{
> subnode.description}" />
> </h:panelGroup>
> </f:facet>
> <f:facet name="file">
> <h:panelGroup>
> <h:selectBooleanCheckbox
> id="_check"
> value="#{
> subnode.infoBean.selected}"
>
> valueChangeListener="#{subnode.infoBean.selectedValueChange}"
> onclick="
> this.form.submit()"/>
> <h:outputText value="#{
> subnode.description}" />
> </h:panelGroup>
> </f:facet>
> </t:tree2>
> </h:panelGroup>
> </t:column>
> </h:dataTable>
>
>
> issue exists for this problem:
>
https://issues.apache.org/jira/browse/TOMAHAWK-926<https://issues.apache.org/jira/browse/TOMAHAWK-926>
>
> Many thanx for your reply
>
> Sébastien
>
--
Regards,
Sébastien LEVER
J2EE Analyst and development engineer
Atos Origin
Systems Integration
Le Millénium - 150 allée Pierre Ziller
06905 Sophia Antipolis Cedex
Phone : +33 (0)4 92 95 24 23
http://www.atosorigin.com