Structures_DataGrid_Renderer_HTMLSortForm

Structures_DataGrid_Renderer_HTMLSortForm – Multiple fields sorting form rendering driver

Description

This driver renders a form (using HTML_QuickForm) so that the user can select several fields and directions to sort the datagrid by.

Supported operations modes

This driver supports the following operation modes:

Supported operations modes of this driver
Mode Supported?
Container Support yes
Output Buffering yes
Direct Rendering no
Streaming no
Object Preserving no

Options

This driver accepts the following options:

Options for this driver
Option Type Description Default Value
buildFooter bool Whether to build the footer. true
buildHeader bool Whether to build the header. true
defaultCellValue string What value to put by default into empty cells. null
defaultColumnValues array Per-column default cell value. This is an array of the form: array(fieldName => value, ...). array()
directionStyle string Whether to render the direction form elements as 'select' or 'radio' elements 'select'
encoding string The content encoding. If the mbstring extension is present the default value is set from mb_internal_encoding(), otherwise it is ISO-8859-1. 'ISO-8859-1'
excludeVars array Variables to be removed from the generated HTTP queries. array()
extraVars array Variables to be added to the generated HTTP queries. array()
fillWithEmptyRows bool Ensures that all pages have the same number of rows. false
hideColumnLinks array By default sorting links are enabled on all columns. With this option it is possible to disable sorting links on specific columns. This is an array of the form: array(fieldName, ...). This option only affects drivers that support sorting. array()
numberAlign bool Whether to right-align numeric values. true
onMove string Name of a Javascript function to call on onclick/onsubmit events when the user is either paging or sorting the data. This function receives a single object argument of the form: { page: <page>, sort: [{field: <field>, direction: <direction>}, ...], data: <user_data> }. Remark: setting this option doesn't remove the href attribute, you should return false from your handler function to void it (eg: for AJAX, etc..). null
onMoveData string User data passed in the "data" member of the object argument passed to onMove. No JSON serialization is performed, this is assigned as a raw string to the "data" attribute. It's up to you to add quotes, slashes, etc... ''
sortFieldsNum int How many fields the user will be able to sort by. This has no effect if the backend does not support sorting by multiple fields. 3
textAscending string Label for the ASC direction 'Ascending'
textChoose string What to display in the select box when no field is selected (first option) 'Choose...'
textDescending string Label for the DESC direction 'Descending'
textSortBy string Label for the first field 'Sort by:'
textSubmit string Label for the submit button 'Submit'
textThenBy string Label for the second and following fields 'Then by:'

Examples

Fill a form with sort fields

<?php
require_once 'HTML/QuickForm.php';

// Create an empty form with your settings
$form = new HTML_QuickForm('myForm''POST');

// Customize it, add a header, text field, etc..
$form->addElement('header'null'Search & Sort Form Example');
$form->addElement('text''my_search''Search for:');

// Let the datagrid add sort fields, radio style
$options = array('directionStyle' => 'radio');
$datagrid->fill($form$options'HTMLSortForm');

// You must add a submit button. fill() never does this
$form->addElement('submit'null'Submit');

// Use the native HTML_QuickForm::display() to print your form
$form->display();

?>