Midcom helper datamanager2 widget chooser

From OpenPSA Wiki

Jump to: navigation, search
Chooser widget in Asgard 2

Chooser is a search-based jQuery widget with creation support in midcom.helper.datamanager2.

It works either with a number of predefined "clever classes", where constraints, orderings and search and return fields are specified. Alternatively, you can specify all necessary parameters manually.

[edit] Available Options

auto_wildcards: add SQL % wildcards to query string. Valid values are 'both', 'start', 'end' and <empty>

[edit] Configuration Example with clever_class

  'styles' => Array
  (
      'title' => 'styles',
      'storage' => null,
      'type' => 'select',
      'type_config' => array
      (
           'require_corresponding_option' => false,
           'allow_multiple' => true,
           'multiple_storagemode' => 'array',
      ),
      'widget' => 'chooser',
      'widget_config' => array
      (
          'clever_class' => 'style',
      ),
  ),

[edit] Configuration Example with creation support

'chooser_test' => Array
(
    'title' => 'chooser_test',
    'storage' => null,
    'type' => 'select',
    'type_config' => array
    (
         'require_corresponding_option' => false,
         'allow_multiple' => false,
         'allow_other' => true,
         'options' => array(),
    ),
    'widget' => 'chooser',
    'widget_config' => array
    (
         'class' => 'my_dba_class',
         'component' => 'my.component',
         'titlefield' => 'title',
         'id_field' => 'id',
         'searchfields' => array
         (
              'title',
         ),
         'orders' => array
         (
              array('title' => 'ASC'), 
         ),
         'result_headers' => array
         (
              array
              (
                   'title' => 'Title',
                   'name' => 'title',
              ),
         ),
         'creation_mode_enabled' => true,
         'creation_handler' => "{$_MIDGARD['self']}create_handler",
         'creation_default_key' => 'no_idea',
    ),
Personal tools