Sorts

Sorts – how to sort results

Introduction

There are two kind of sort with the advmultiselect element: The first one is only available by programming and allow an auto-arrange (alphabetic or reverse order) of each select list. The second is for end-user and allow them to sort their selection as they want.

These features required HTML_QuickForm_advmultiselect package version 0.5.0 or better.

Auto-arrange

In some case, it could be interresting to have items lists sort alphabetically when elements are moved between them, rather than gets added to the bottom (default behavior).

To get both list sort alphabetically, you have to set the $sort parameter of the HTML_QuickForm_advmultiselect class constructor with the PHP SORT_ASC constant.

To get both list sort in reverse order, you have to set the $sort parameter of the HTML_QuickForm_advmultiselect class constructor with the PHP SORT_DESC constant.

A full example is given in appendices. See the sort usage

With buttons

The other way to have your selection sorted is with help of two buttons: moveup to move an item to the top of the list, and movedown to move an item to the bottom of the list.

These buttons works only with the selection list

A full example is given in appendices. See the sort usage