? datatables-multifilter.patch
Index: datatables.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/datatables/datatables.module,v
retrieving revision 1.3.2.3
diff -u -p -w -B -r1.3.2.3 datatables.module
--- datatables.module	26 Aug 2010 01:03:58 -0000	1.3.2.3
+++ datatables.module	8 Dec 2010 02:07:54 -0000
@@ -253,6 +253,7 @@ function template_preprocess_datatables_
   $datatable_options['bInfo'] = $options['elements']['table_info'];
   $datatable_options['bFilter'] = $options['elements']['search_box'];
   $datatable_options['bStateSave'] = $options['elements']['save_state'];
+$datatable_options['bMultiFilter'] = $options['elements']['multi_filter'];
   
   $datatable_options['bLengthChange'] = $options['pages']['length_change'];
   $datatable_options['iDisplayLength'] = (int) $options['pages']['display_length'];
@@ -291,7 +292,7 @@ function template_preprocess_datatables_
     $vars['row_classes'][$num][] = ($num % 2 == 0) ? 'odd' : 'even';
   }
   
-  $vars['class'] = 'views-table';
+$vars['class'] = 'views-table display';
   $vars['id'] = _datatables_get_id();
 
   drupal_add_css(drupal_get_path('module', 'datatables') .'/dataTables/media/css/demo_table.css');
Index: js/datatables.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/datatables/js/datatables.js,v
retrieving revision 1.1.2.1
diff -u -p -w -B -r1.1.2.1 datatables.js
--- js/datatables.js	26 Aug 2010 01:03:58 -0000	1.1.2.1
+++ js/datatables.js	8 Dec 2010 02:07:54 -0000
@@ -22,6 +23,43 @@ Drupal.behaviors.datatables = function (
 
     var datatable = $(selector).dataTable(this);
 
+	var asInitVals = new Array();
+
+	if (this.bMultiFilter) {
+
+		// The code below is taken almost verbatim from the examples at datatables.net
+		//   http://www.datatables.net/examples/api/multi_filter.html
+
+		// Apply the actual filter to the table.
+		$("tfoot input").keyup( function () {
+			// Filter on the column (the index) of this element
+			datatable.fnFilter( this.value, $("tfoot input").index(this) );
+		} );
+
+		// Support functions to provide a little bit of 'user friendlyness' to the textboxes in the footer
+		$("tfoot input").each( function (i) {
+			asInitVals[i] = this.value;
+		} );
+
+		$("tfoot input").focus( function () {
+			if ( this.className == "search_init" )
+			{
+				this.className = "";
+				this.value = "";
+			}
+		} );
+
+		$("tfoot input").blur( function (i) {
+			if ( this.value == "" )
+			{
+				this.className = "search_init";
+				this.value = asInitVals[$("tfoot input").index(this)];
+			}
+		} );
+
+	} // /bMultiFilter
+
+
     if (this.bExpandable) {
       var settings = datatable.fnSettings();
       // Add blank column header for show details column.
Index: views/datatables-view.tpl.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/datatables/views/datatables-view.tpl.php,v
retrieving revision 1.1
diff -u -p -w -B -r1.1 datatables-view.tpl.php
--- views/datatables-view.tpl.php	16 Dec 2009 00:59:58 -0000	1.1
+++ views/datatables-view.tpl.php	8 Dec 2010 02:07:54 -0000
@@ -38,4 +38,15 @@
       </tr>
     <?php endforeach; ?>
   </tbody>
+	<?php
+	$options = $view->style_plugin->options;
+	if ($options['elements']['multi_filter']) { ?>
+	<tfoot>
+		<tr>
+		<?php foreach ($header as $field => $label): ?>
+			<th><input type="text" name="<?php print $field; ?>" value="<?php print $label; ?>" class="search_init" /></th>
+		<?php endforeach; ?>
+		</tr>
+	</tfoot>
+	<?php } ?>
 </table>
Index: views/datatables_style_plugin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/datatables/views/datatables_style_plugin.inc,v
retrieving revision 1.1.2.2
diff -u -p -w -B -r1.1.2.2 datatables_style_plugin.inc
--- views/datatables_style_plugin.inc	26 Aug 2010 01:03:58 -0000	1.1.2.2
+++ views/datatables_style_plugin.inc	8 Dec 2010 02:07:54 -0000
@@ -56,6 +56,12 @@ class datatables_style_plugin extends vi
       '#default_value' => !empty($this->options['elements']['save_state']),
       '#description' => t("DataTables can use cookies in the end user's web-browser in order to store it's state after each change in drawing. What this means is that if the user were to reload the page, the table should remain exactly as it was (length, filtering, pagination and sorting)"),
     );
+	$form['elements']['multi_filter'] = array(
+	  '#type' => 'checkbox',
+	  '#title' => t('Enable multi filter.'),
+	  '#default_value' => !empty($this->options['elements']['multi_filter']),
+	  '#description' => 'The multi filter boxes allow users to dynamically filter each column in the table.  Disabling this option will hide the multi filter boxes from users.',
+	);
     
     $form['layout'] = array(
       '#type' => 'fieldset',
