TreeListBase.NodeImageIndex

Syntax

NodeImageIndex: Array of Number;

Description

The NodeImageIndex property determines icon index of the specified node.

Comments

Use the setNodeImageIndex(nodeKey, value) method to set the property value and the getNodeImageIndex(nodeKey) method to get the property value.

Parameters:

nodeKey. String. Node identifier

value. Number. Value.

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 the connected list of images:

// Create tree contents
json = [
  { Key: '0', Content: ['Node0', 'Node0 - Col2'], ImageIndex: 4},
  { Key: '1', Content: ['Node1', 'Node1 - Col2'], Selected: true },
  { Key: '2', Content: 'Node2' },
  { Key: '3', Content: 'Node3' },
    { Key: '4', Content: 'Node4', Parent: '0' },
    { Key: '5', Content: 'Node5', Parent: '0' },
    { Key: '6', Content: 'Node6', Parent: '0' }
]
// 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 icons list
  ImageList: imageList = new PP.ImageList({
    Source: '../ListImages.gif',
    IconHeight: 20,
    IconWidth: 20
  }),
});
// Change second node icon
Tree.setNodeImageIndex(1, [1,2]);

After executing the example the SimpleTreeList component is created with using of images. The first node has an icon with the 4 index. The second node has an icon from the second row with the 2 index.

See also:

TreeListBase