Class for Sorting Table Element Tree Nodes

Description: class containing method for sorting table element tree nodes.

The SortElementsManager.h File

#ifndef __BaseAnalysis__SortElementsManager__
#define __BaseAnalysis__SortElementsManager__
#include "NFoundation.h"
nu_class_name(SortElementsManager)
class_inherits(SortElementsManager, NObject)
{
    public:
    NComparisonResult sortSelector(NID obj1 , NID obj2) {
        // Get tree nodes
        SPPLCommonMultiTreeNode node1 = obj1->qClass<PPLCommonMultiTreeNode>();
        SPPLCommonMultiTreeNode node2 = obj2->qClass<PPLCommonMultiTreeNode>();
        // Calculate hash for tree node descriptions
        NUInteger hash1 = node1->description()->hash();
        NUInteger hash2 = node2->description()->hash();
        if(hash1 == hash2)
        return NOrderedSame;
        // Sort tree nodes by descending
        if(hash1 > hash2)
        return NOrderedAscending;
        else
        return NOrderedDescending;
    }
};
#endif

See also:

Working with Table Header Elements