Home Analyst Portal

Sort order of Custom Portal Tasks?

Kenneth_McMichaelKenneth_McMichael Customer IT Monkey ✭
I've got code in my custom.js like below...

// show task 1
$.getScript("/CustomSpace/custom_task1.js");
// show task 2
$.getScript("/CustomSpace/custom_task2.js")
// show task 3
$.getScript("/CustomSpace/custom_task3.js")

As these add up, the order in which it displays is inconsistent - Is there a way in the custom.js to specify which order these should appear in?

I think I saw somewhere else where the default options are coming from the controller.js - which is okay. I'm just looking for sorting the additional tasks I am adding.

thanks in advance!

Best Answers

  • Ryan_LaneRyan_Lane Advanced IT Monkey ✭✭✭
    Accepted Answer
    Hello!
    I have this function you can use in custom.js to sort custom tasks alphabetically using the jquery sort function:
    function sortTaskList() {
    	var taskList = $('.taskmenu'),
    		listitems = taskList.children('li').get();
    	listitems.sort(function (a, b) {
    		return $(a).text().toUpperCase().localeCompare($(b).text().toUpperCase());
    	});
    	$.each(listitems, function (idx, itm) { taskList.append(itm); });
    }

  • Kenneth_McMichaelKenneth_McMichael IT Monkey ✭
    Accepted Answer
    thanks! I'll give this a try

Answers

  • Ryan_LaneRyan_Lane Customer Advanced IT Monkey ✭✭✭
    Accepted Answer
    Hello!
    I have this function you can use in custom.js to sort custom tasks alphabetically using the jquery sort function:
    function sortTaskList() {
    	var taskList = $('.taskmenu'),
    		listitems = taskList.children('li').get();
    	listitems.sort(function (a, b) {
    		return $(a).text().toUpperCase().localeCompare($(b).text().toUpperCase());
    	});
    	$.each(listitems, function (idx, itm) { taskList.append(itm); });
    }

  • Kenneth_McMichaelKenneth_McMichael Customer IT Monkey ✭
    Accepted Answer
    thanks! I'll give this a try
Sign In or Register to comment.