TreeListBase.checkExpansion

Syntax

checkExpansion(fireEvents);

Parameters

fireEvents. Boolean. Generate change event. Optional parameter.

Description

The checkExpansion method checks whether nodes are expanded correctly.

Example

To execute the example, in the HEAD tag add links to component library PP.js and visual style tables PP.css. Add a DIV element with the "container" identifier in the BODY tag. The example differs from the Example of Creating the SimpleTreeList Component by two nodes with children an a single node expansion mode:

// Create tree contents
json = [
  { Key: '0', Content: ['Node0', 'Node0 - Col2'] },
  { Key: '1', Content: ['Node1', 'Node1 - Col2'], Selected: true },
  { Key: '2', Content: 'Node2' },
  { Key: '3', Content: 'Node3' },
    { Key: '4', Content: 'Node0 1', Parent: '0' },
    { Key: '5', Content: 'Node0 2', Parent: '0' },
    { Key: '6', Content: 'Node0 2', Parent: '0' },
    { Key: '7', Content: 'Node1 1', Parent: '1' },
    { Key: '8', Content: 'Node1 2', Parent: '1' },
    { Key: '9', Content: 'Node1 3', Parent: '1' }
]
// Create a tree
Tree = new PP.Ui.SimpleTreeList({
  ParentNode: 'container',
  Width: 400,
  Height: 400,
  Captions:  [{
    Content: 'First',
    Width: '40%'
    },{
    Content: 'Second',
    Width: '60%'
    }],
  ShowCheckBoxes: true,
  ShowCaptions: true,
  ShowTree: true,
  DataObject: json,
  // Set single tree expand mode
  ExpansionMode: PP.Ui.TreeListExpansionMode.SingleExpand
});
// Set expanding for both branches
Tree.setNodeExpanded(0, true, false, true);
Tree.setNodeExpanded(1, true, false, true);
// Correct incorrect displaying of expanded trees
Tree.checkExpansion();

After executing the example the SimpleTreeList component is created with a single node expansion mode.

See also:

TreeListBase