How to show records in descending order on the widget.

Obito
Tera Expert

Hi All ,

The request widget on portal is type of 'Simple list' widget and showing records in ascending order, How can I make widget show the records in descending order.

find_real_file.png

3 REPLIES 3

Jan Cernocky
Tera Guru

Which widget are you referring to in your screenshot? I found My Request widget in my PDI and the server script has sorting in DESC order. 

find_real_file.png

Just ctrl+right click on your widget and select Widget in editor and check the server part for how the GlideRecord is being built. It seems the ordering cannot be defined by instance option parameter.

If you want to change the behavior you would have to clone the widget, adjust the code according to your needs and replace it on the main page

 

Hi, 

Thanks for reply.

I am using simple list widget. How can I do that in simple list widget.

Hi Obito,

it seems a bit weird to me. The simple list has this code in server part

find_real_file.png

this parameter is not defined in the instance, but for some reason the widget is reading it from somewhere (if you ctrl+right click on the widget on the main page and select 'Log to console: $scope' and open the browser dev tools you see this

find_real_file.png

Normally, you would go to the widget instance and add this bit

find_real_file.png

this however is not working for me (it keeps the 'asc' value.

What however helped was to 

- clone the widget

- edit options schema and add order_direction parameter there and set value to desc

- added the new widget to the page instead of the default one

find_real_file.png

This is not ideal but works. Let me know if you get stuck somewhere