| Author |
Message |
![[Post New]](/JForum/templates/default/images/icon_minipost_new.gif) 24/10/2009 19:17:05
|
applefan
Joined: 03/10/2009 00:00:00
Messages: 24
Offline
|
Hi,
I'm working on a custom TreeTable component (since ICEFaces lacks one). It is made by reserving the first column of a DataTable to show the proper indentation of the element and, in case of an internal node (i.e., non leaf), a command button to expand/collapse the node.
Everything works fine, until I want to add row selection.
By inserting an ice:rowSelector I came across two "bugs" (unsought behaviour):
1- If an user selects the expand/collapse command (an ice:commandButton) to toggle the state of the node, it is recognized as a row selection and this should not happen
2- When a node is expanded/collapsed, the data model behind the DataTable is "refreshed" by removing elements hidden by this action. This creates a problem with rowSelector. Suppose a node A has a child B. Suppose that B has been selected. If A is collapsed, the data model (i.e., the "linearized tree") is updated and when rowSelector tries to set the Selected variable on B it generates a non fatal error because it tries to call a method on a non existent row.
If the full tree is always rendered (i.e. the data model is not refreshed and only the internal state of the nodes is changed -- for example, via a isVisible variable), the second bug did not occur.
So i need a way to bypass the call to rowSelector if the commandButton is clicked and a way to hide a row from being displayed to the user (based on the evaluation of a boolean variable).
I'm using SEAM 2.2.0GA with ICEFaces 1.8.1
Of course if someone comes with a better idea to handle this, he's welcome.
Can someone give me a hand?
Thank you.
|
|
|
 |
![[Post New]](/JForum/templates/default/images/icon_minipost_new.gif) 26/10/2009 08:56:16
|
judy.guglielmin
Joined: 20/02/2007 00:00:00
Messages: 1196
Offline
|
A TreeTable (composite ICEfaces) component is available with ICEpack. Please read to see if this is suitable for you.
|
|
|
 |
![[Post New]](/JForum/templates/default/images/icon_minipost_new.gif) 26/10/2009 11:24:49
|
applefan
Joined: 03/10/2009 00:00:00
Messages: 24
Offline
|
judy.guglielmin wrote:
A TreeTable (composite ICEfaces) component is available with ICEpack. Please read to see if this is suitable for you.
The ICEPack is reserved for supported customers (i.e., people or enterprises who can afford to pay). I am a student (i.e., people who can't afford to pay).
I understand that you run an enterprise and you have to make money out of it, but the paid solution is not an option in this case.
|
|
|
 |
![[Post New]](/JForum/templates/default/images/icon_minipost_new.gif) 10/05/2010 14:14:50
|
nsolomon
Joined: 23/04/2010 00:00:00
Messages: 6
Offline
|
I found at least a partial solution to these problems. I am implementing a similar expandable table and ran into similar issues.
As far as this concern goes:
2- When a node is expanded/collapsed, the data model behind the DataTable is "refreshed" by removing elements hidden by this action. This creates a problem with rowSelector. Suppose a node A has a child B. Suppose that B has been selected. If A is collapsed, the data model (i.e., the "linearized tree") is updated and when rowSelector tries to set the Selected variable on B it generates a non fatal error because it tries to call a method on a non existent row.
I was able to fix this issue by setting the rowSelector attribute multiple="true" and then dealing with the selection state in my backing bean.
Code:
<ice:rowSelector id="rowSelector"
value="#{row.selected}"
multiple="true"
selectionListener="#{controller.selectionListener}"/>
Code:
//get the actual object backing the row and pass it to this function
private void setSelectedPosit(IRow pRow)
{
if(mSelectedRow != null ){
mSelectedRow.setSelected(false);
}
mSelectedRow = pRow;
}
mSelectedRow is the previously selected row. I keep a reference to this object in my backing bean so that when a new row is clicked, I can deselect the previous row.
As far as the first item is concerned:
1- If an user selects the expand/collapse command (an ice:commandButton) to toggle the state of the node, it is recognized as a row selection and this should not happen
I actually don't mind that my table behaves this way. However, I can't think of a way to fix it either. There seems to be no way of telling whether the user has clicked the expand/collapse button or just selected/deselected the row.
Hope this helps.
|
|
|
 |
|
|