AEM 6 SP2 - Classic UI Task Management Sort Task Projects Tree Nodes

Goal


Alphabetically sort the Task Projects tree in Task Management console http://localhost:4502/libs/cq/taskmanagement/content/taskmanager.html#/tasks

Demo | Package Install


Product



Extension



Solution


1) Login to CRXDE Lite, create folder (nt:folder) /apps/classicui-sort-task-projects

2) Create clientlib (type cq:ClientLibraryFolder/apps/classicui-sort-task-projects/clientlib and set a property categories of String type to cq.taskmanagement

3) Create file ( type nt:file ) /apps/classicui-sort-task-projects/clientlib/js.txt, add the following

                         sort.js

4) Create file ( type nt:file ) /apps/classicui-sort-task-projects/clientlib/sort.js, add the following code

(function(){
    var pathName = window.location.pathname;

    if( pathName.indexOf("/libs/cq/taskmanagement/content/taskmanager.htm") != 0 ){
        return;
    }

    var TREE_ID = "cq-taskmanager-tree";

    function sort(treePanel, asc){
        treePanel.on('load', function(node){
            node.childNodes.sort(function(a,b){
                a = a["text"].toLowerCase();
                b = b["text"].toLowerCase();
                return asc ? ( a > b ? 1 : (a < b ? -1 : 0) ) : ( a > b ? -1 : (a < b ? 1 : 0) ) ;
            });
        })
    }

    var INTERVAL = setInterval(function(){
        var tree = CQ.Ext.getCmp(TREE_ID);

        if(tree){
            clearInterval(INTERVAL);
            sort(tree, true);
        }
    }, 250);
}());


1 comment:

  1. I already worked on many management software. Currently I am working on My Task Management System, which is Task Management System.

    ReplyDelete