Quantcast
Channel: XPages – Xcellerant
Viewing all articles
Browse latest Browse all 216

XPages Tip: Working around a Bug to Allow Collapsing Links within a Container in an xe:navigator control

$
0
0

I noticed a bug when working with an xe:navigator control with container nodes. The properties panel property does allow it to be expandable in 8.5.3 UP1.

By default, the navigator’s expandable property is set to true. When you add container nodes to a navigator control, you would expect that they would be expandable.

navigator_1

Here’s the source for a navigator with two levels of nested nodes.

<xe:navigator id="navigator1">
  <xe:this.treeNodes>
    <xe:basicLeafNode label="Link 1"></xe:basicLeafNode>
    <xe:basicLeafNode label="Link 2"></xe:basicLeafNode>
    <xe:basicContainerNode label="Container 1">
      <xe:this.children>
        <xe:basicLeafNode label="Child Link 1.1"></xe:basicLeafNode>
        <xe:basicLeafNode label="Child Link 1.2"></xe:basicLeafNode>
        <xe:basicContainerNode label="Container 2">
          <xe:this.children>
            <xe:basicLeafNode label="Link 1.2.1"></xe:basicLeafNode>
            <xe:basicLeafNode label="Link 1.2.2"></xe:basicLeafNode>
          </xe:this.children>
        </xe:basicContainerNode>
      </xe:this.children>
    </xe:basicContainerNode>
  </xe:this.treeNodes>
</xe:navigator>

The Problem

Even though the navigator’s expanded property was set to true, the container nodes are not collapsible — they default to being fully expanded.

navigator_2

However, I noticed that when the expandable property is deselected, an expandable attribute is added to the navigator tag and set to false. This changes line 1 from the source above to this:

<xe:navigator id="navigator1" expandable="false">

But when the property is re-selected, the expandable attribute disappears.

The Solution

The good news is that there’s an easy solution. All you need to add the expandable attribute back to the navigator tag and set it to true.

<xe:navigator id="navigator1" expandable="true">

Now there are twisties next to the container nodes that provide the ability to collapse them.

navigator_3

Another Solution

If you set the expandable property of the navigator under All Properties, it also works to set the proper attribute on the navigator.

navigator_4



Viewing all articles
Browse latest Browse all 216

Trending Articles