Solving Your Intermittent Tree Editing Problem

A user struggles with a problem in his af:treeTable where an af:inputText field bound to a Name attribute intermittently refuses to edit the value in its table cell, behaving instead as a read-only value. It only occurs on the 2nd and subsequent levels of the tree, and typically happens after doing an Expand All... and then clicking around into different rows of the treeTable. The rows/nodes at the root of the tree are always correctly editable.

The problem stems from the fact that his tree was referencing the value of the Name attribute using the expression #{node.Name} like this:

        <af:treeTable value="#{bindings.ProjectCodeTypeVO1.treeModel}"
                      var="node"
                      selectionListener="#{bindings.ProjectCodeTypeVO1.treeModel.makeCurrent}"
                      rowSelection="single" id="tt1" partialTriggers="::ctb1"
                      editingMode="clickToEdit">
          <f:facet name="nodeStamp">
            <af:column id="c1" headerText="ID">
              <af:outputText value="#{node.Id}" id="ot2"/>
            </af:column>
          </f:facet>
          <af:column id="c2" headerText="Name">
            <af:inputText value="#{node.Name}" id="ot3"
                                  autoSubmit="true"/>
          </af:column>
        </af:treeTable>

The node variable represents the current row in the treeModel's data collection, so the #{node.Name} expression represents the value of that row's Name attribute. However, this is an expression that is fine for read-only access of the Name attribute.

To reliably be able to edit the attribute value in the UI, you need to use the following expression instead which causes the ADF model data binding layer to dynamically create attribute bindings to support the edit of each cell:

<af:column id="c2" headerText="Name">
            <af:inputText value="#{node.bindings.Name.inputValue}" id="ot3"
                                  autoSubmit="true"/>
          </af:column>

Once you use the correct EL expression, the editable tree/treeTable will behave as expected.

Comments:

Post a Comment:
Comments are closed for this entry.
About
Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today