cancel
Showing results for 
Search instead for 
Did you mean: 

Datalist item ordering

pcharsle
Confirmed Champ
Confirmed Champ
Our users often wish to use datalists to create ordered lists of tasks. They use the sumple task list and create items with titles as follows:

1. task 1
2. task 2
3. task 3
….

However, when other users view the list, the item order is different and they have to manually click the title bar to resort. Is there a way to customise the out of the box datalists so that when they first open, they are displayed sorted by a specific column?
1 ACCEPTED ANSWER

ddraper
World-Class Innovator
World-Class Innovator

The REST API used to retrieve data list items does not support sort parameters. The sorting is handled on the client side. Sorting is handled in the datagrid.js file (which defines the Alfresco.component.DataGrid), in the function returned by getSortFunction. 


I think the best option is going to be to extend the DataGrid widget to extend both onActiveDataListChanged function so that the sort function is called when a data list is loaded.

This blog post describes how you can extend YUI2 widgets. The WebScript to extend will be the datalists.get.js JavaScript controller (to change the widget that is instantiated) and the datalists.get.html.ftl template to include the custom widget.

View answer in original post

1 REPLY 1

ddraper
World-Class Innovator
World-Class Innovator

The REST API used to retrieve data list items does not support sort parameters. The sorting is handled on the client side. Sorting is handled in the datagrid.js file (which defines the Alfresco.component.DataGrid), in the function returned by getSortFunction. 


I think the best option is going to be to extend the DataGrid widget to extend both onActiveDataListChanged function so that the sort function is called when a data list is loaded.

This blog post describes how you can extend YUI2 widgets. The WebScript to extend will be the datalists.get.js JavaScript controller (to change the widget that is instantiated) and the datalists.get.html.ftl template to include the custom widget.