// TODO // - Tidy up class names // - Option to have vertical layout class // - Number of horizontal panels class options // - Threshold option - require that there is duplicate information in a column before it is used // - Styling for selected // - Styling for container / header // - Styling for clear option // - State saving integration // - Fix regex characters - (CEO) for example (function( factory ){ if ( typeof define === 'function' && define.amd ) { // AMD define( ['jquery', 'datatables.net'], function ( $ ) { return factory( $, window, document ); } ); } else if ( typeof exports === 'object' ) { // CommonJS module.exports = function (root, $) { if ( ! root ) { root = window; } if ( ! $ || ! $.fn.dataTable ) { $ = require('datatables.net')(root, $).$; } return factory( $, root, root.document ); }; } else { // Browser factory( jQuery, window, document ); } }(function( $, window, document, undefined ) { 'use strict'; var DataTable = $.fn.dataTable; function SearchPanes ( settings, opts ) { var that = this; var table = new DataTable.Api( settings ); this.s = { dt: table }; this.dom = { container: $('
') .appendTo( opts.container ) } table.columns(opts.columns).eq(0).each( function ( idx ) { that._pane( idx ); } ); $(this.dom.container) .on( 'click', 'li', function () { that._toggle( this ); } ) .on( 'click', 'button.close', function () { that._clear( $(this).closest('div.pane') ); } ); } $.extend( SearchPanes.prototype, { _binData: function ( data, tags ) { var out = {}; var add = function ( d ) { if ( ! out[ d ] ) { out[ d ] = 1; } else { out[ d ]++; } }; data.each( function (d) { if ( ! d ) { return; } if ( tags ) { var a = d.split(','); for ( var i=0, ien=a.length ; i