Patch adds support for using select boxes as search input controls

detour - June 19, 2009 - 22:46
Project:Ajax Table
Version:5.x-1.2
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:needs review
Description

This patch adds support to Ajax Table for using select boxes (drop-down or list boxes) as search input controls. This is a much quicker way of specifying a term to search (rather than typing) if there are a set number of choices.

Here's an example of how to define a select box for a search input within an Ajax Table definition:

$search_inputs = array(
  array(
    'type' => 'select',
    'id' => 'status',
    'operator' => '=',
    'options' => array('available => 'Available', 'pending' => 'Pending', 'complete' => 'Completed', 'canceled' => 'Canceled'),
    'col' => 'status',
    'attributes' => array('size' => '1'),
  ),
);
$inputs = ajaxtable_search_inputs($search_inputs);
$theme['search'] = '<div class="ajaxtable-header-title">Items</div>
<table class="ajaxtable-default-search-table">
  <tr>
    <td>Search by Title: {search_input}</td>
    <td>Filter by Status: '. $inputs['status']['input'] .' '. $inputs['status']['help'] .'</td>
    <td>{search_button}</td>
  </tr>
</table>';

AttachmentSize
ajaxtable-search_input_select.patch1.98 KB
 
 

Drupal is a registered trademark of Dries Buytaert.