DimTreeView.SortChanged

Syntax

SortChanged: function (sender, args)

Parameters

sender. Event source.

args. Event information.

Description

The SortChanged event occurs on changing the sorting method.

Comments

To change sorting type, select the Sorting item in the component's context menu, or click the arrow in the column header.

The SortChanged event occurs after executing the DimTreeView.sort method, if the fireEvent parameter of this method is set to True (default).

Example

To execute the example, the HTML page must contain the DimTree component named dimTree (see Example of Creating the DimTree Component). Tree data source (dictionary of Foresight Analytics Platform) must contain an attribute with the ID identifier. Add a button named button1 clicking which sorts elements in descending order:

    var button1 = new PP.Ui.Button(
    {
        ParentNode: document.getElementById("Div2"),
        Content: "Sort"
    });
    button1.Click.add(function (sender, args)
    {
      //If ascending sorting is selected, descending sorting is applied  
      if (dimTree.getSortType() == PP.Ui.TreeListSort.asc) dimTree.sort("ID", PP.Ui.TreeListSort.desc)
    });
    dimTree.SortChanged.add(function (sender, args)
    {
      //On changing the sorting type the console displays identifier of the attribute, by which the tree is sorted   
      console.log(dimTree.getCurrentSortAtrId())
    });

After executing the example, descending sorting is selected if the ascending sorting has been set before. The browser console will show identifier of the dictionary attribute used for sorting.

See also:

DimTreeView