Documentation
Kitchen Sink documentation of style: 'Delos' of skin: 'ILIAS'
Sortation
Description
- Purpose
- The sortation view control enables users to change the order in which some data is presented. This control applies to all sorts of _structured_ data, like tables and lists.
- Composition
- Sortation uses a Dropdown to display a collection of shy-buttons.
- Effect
- A click on an option will change the ordering of the associated data-list by calling a page with a parameter according to the selected option or triggering a signal. The label displayed in the dropdown will be set to the selected sorting.
Rules
- Usage
- A Sortation MUST NOT be used standalone.
- Sortations MUST BE visually close to the list or table their operation will have effect upon.
- There SHOULD NOT be more than one Sortation per view.
- Accessibility
- Sortation MUST be operable via keyboard only.
Example 1: Async
//Async example show-casing how this control can be used, without reloading the page function async() { //Loading factories global $DIC; $f = $DIC->ui()->factory(); $renderer = $DIC->ui()->renderer(); //Initializing the options, note that the label is taken care of by JS $options = [ 'default_option' => 'Default Ordering', 'latest' => 'Most Recent Ordering', 'oldest' => 'Oldest Ordering' ]; //Note that the selected option needs to be displayed in the label $select_option = 'default_option'; if ($_GET['sortation']) { $select_option = $_GET['sortation']; } //Generation of the UI Component $modal = $f->modal()->lightbox($f->modal()->lightboxTextPage('Note: This is just used to show case, how this control can be used,to change an other components content.', "Sortation has changed: " . $options[$_GET['sortation']])); $s = $f->viewControl()->sortation($options) ->withTargetURL($DIC->http()->request()->getRequestTarget(), 'sortation') ->withLabel($options[$select_option]) ->withOnSort($modal->getShowSignal()); //Rendering return $renderer->render([$s,$modal]); }
Example 2: Base
//Base example, show-casing how this control is used if firing leads to some //Reload of the page function _Base() { //Loading factories global $DIC; $f = $DIC->ui()->factory(); $renderer = $DIC->ui()->renderer(); //Initializing the options $options = [ 'default_option' => 'Default Ordering', 'latest' => 'Most Recent Ordering', 'oldest' => 'Oldest Ordering' ]; //Note that the selected option needs to be displayed in the label $select_option = 'default_option'; if ($_GET['sortation']) { $select_option = $_GET['sortation']; } //Generation of the UI Component $s = $f->viewControl()->sortation($options) ->withTargetURL($DIC->http()->request()->getRequestTarget(), 'sortation') ->withLabel($options[$select_option]); //Rendering return $renderer->render($s); }
Example 3: Small
//This can be used, when space is very scarce and the label can not be displayed function small() { //Loading factories global $DIC; $f = $DIC->ui()->factory(); $renderer = $DIC->ui()->renderer(); $options = array( 'default_option' => 'Default Ordering', 'latest' => 'Most Recent Ordering', 'oldest' => 'Oldest Ordering' ); //Note that no label is attached $s = $f->viewControl()->sortation($options) ->withTargetURL($DIC->http()->request()->getRequestTarget(), 'sortation'); return $renderer->render($s); }
Relations
- Parents
- UIComponent
- View Control