TMACUL

http://www.servicedeskusers.com/Additional_Sorting_on_List_Panel.

Blog Post created by TMACUL Champion on Jan 1, 2016

Additional Sorting on List Panel

 

From SDU

Jump to: navigation, search

 

To make corrections or additions to this article, select the edit tab above.
To discuss or ask questions about this article, select the discussion tab above.


 

Overview

This article elaborates on how to sort on additional columns in a list panel (in casu list_in.htmpl).

Basic sorting

The basic principle to sort on additional columns is to add it to the SORT statement of a .mod file

For example to sort on assignee, code:

OBJECT cr { FACTORY in { STANDARD_LISTS { SORT_BY "open_date DESC, id DESC, status, priority DESC, ref_num, assignee"; MLIST OFF; RLIST OFF; }; }; }; 

Doing this, you will now notice that the list orders by Assignee UUID, and not the Assignee Name. This can be solved by including the Assignee Combo_Name in the list panel, and sorting on the Combo_Name instead.

The code now looks like:

OBJECT cr { FACTORY in { STANDARD_LISTS { SORT_BY "open_date DESC, id DESC, status, priority DESC, ref_num, assignee.combo_name"; MLIST OFF; RLIST OFF; }; }; }; 

Obviously you can do the same for all fields where combo_name is available (eg. group).

However, if you would like to sort on Category Symbol, then we don't have an equivalent to combo_name. Therefor you should first create on.

Add the following to your .mod file to create this (I called it catName here):

OBJECT pcat { ATTRIBUTES Prob_Category { catName DERIVED(sym); } ; } ; 

And again change your Sort code to the following:

OBJECT cr { FACTORY in { STANDARD_LISTS { SORT_BY "open_date DESC, id DESC, status, priority DESC, ref_num, assignee.combo_name, group.combo_name, category.catName"; MLIST OFF; RLIST OFF; }; }; }; 

Edit In List

Because some fields (such as assignee) or now no longer in the list, the Edit-In-List function will fail. What you can do is add these fields back to the list, but make them invisible as to not clutter the list with redundant information. Good practice is to add them on the second line.

As to make this field invisible, you must attach a style to it. Be aware that you can only add a style to a field that is defined as a link. So the assignee field must be set to link.

Then add the following code to your list panel:

<pdm_macro name=lsWrite text="HideMe = 'listHide';"> 
<PDM_MACRO NAME=lsCol hdr=Assignee attr=assignee.combo_name nowrap=yes justify=left> 
<PDM_MACRO NAME=lsCol attr=assignee link=yes justify=left style=HideMe> 

And define your style in the Analyst StyleSheet:

A.listHide { VISIBILITY: hidden; } 

Compatibility

This all works fine in FireFox, but what a surprise IE doesn't like it. What happens is that IE tries to put the focus on the last link field, which is now hidden. Hence it fails.

Therefore I added the ref_num again at the end of the second line. OK, I now have the ref_num twice (see screenshot) but at least it works with IE also.

Image:Example.jpg

Final Note

It may happen that the newly created sort will not be available until you hit the Search button. This is because your system is initially displaying list_cr instead of list_in or list_pr. In that case you will need to apply some fixes from CA.

Retrieved from "http://www.servicedeskusers.com/Additional_Sorting_on_List_Panel"

 

This page was last modified 20:06, 27 May 2010.  This page has been accessed 5,335 times.  Content is available under Attribution-Noncommercial-Share Alike 3.0 UnportedDisclaimers

Outcomes