diff --git a/features/searchPane/dataTables.searchPane.js b/features/searchPane/dataTables.searchPane.js index ab86201..916fc6a 100644 --- a/features/searchPane/dataTables.searchPane.js +++ b/features/searchPane/dataTables.searchPane.js @@ -8,208 +8,227 @@ // - State saving integration // - Fix regex characters - (CEO) for example - -(function( factory ){ - if ( typeof define === 'function' && define.amd ) { +(function(factory) { + if (typeof define === 'function' && define.amd) { // AMD - define( ['jquery', 'datatables.net'], function ( $ ) { - return factory( $, window, document ); - } ); - } - else if ( typeof exports === 'object' ) { + define(['jquery', 'datatables.net'], function($) { + return factory($, window, document); + }); + } else if (typeof exports === 'object') { // CommonJS - module.exports = function (root, $) { - if ( ! root ) { + module.exports = function(root, $) { + if (!root) { root = window; } - if ( ! $ || ! $.fn.dataTable ) { + if (!$ || !$.fn.dataTable) { $ = require('datatables.net')(root, $).$; } - return factory( $, root, root.document ); + return factory($, root, root.document); }; - } - else { + } else { // Browser - factory( jQuery, window, document ); + 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.classes = $.extend( true, {}, SearchPanes.classes ); - - this.dom = { - container: $('
') - .addClass( this.classes.container ) - .appendTo( opts.container ) - }; +})(function($, window, document, undefined) { + 'use strict'; + var DataTable = $.fn.dataTable; - this.s = { - dt: table - }; + function SearchPanes(settings, opts) { + var that = this; + var table = new DataTable.Api(settings); - table.columns(opts.columns).eq(0).each( function ( idx ) { - that._pane( idx ); - } ); + this.classes = $.extend(true, {}, SearchPanes.classes); - $(this.dom.container) - .on( 'click', 'li', function () { - that._toggle( this ); - } ) - .on( 'click', 'button.'+this.classes.clear, function () { - that._clear( $(this).closest('div.'+that.classes.pane.container) ); - } ); -} + this.dom = { + container: $('
') + .addClass(this.classes.container) + .appendTo(opts.container) + }; + this.s = { + dt: table + }; -$.extend( SearchPanes.prototype, { - _binData: function ( data ) { - var out = {}; + 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.' + this.classes.clear, function() { + that._clear($(this).closest('div.' + that.classes.pane.container)); + }); + } - data.each( function (d) { - if ( ! d ) { - return; - } + $.extend(SearchPanes.prototype, { + _binData: function(data) { + var out = {}; - if ( ! out[ d ] ) { - out[ d ] = 1; - } - else { - out[ d ]++; - } - } ); - - return out; - }, - - _clear: function ( pane ) { - var classes = this.classes; - var itemSelected = classes.item.selected; - - pane.find( 'li.'+itemSelected ).removeClass( itemSelected ); - pane.removeClass( classes.pane.active ); - - this.s.dt - .column( pane.data('column') ) - .search('') - .draw(); - }, - - _pane: function ( idx ) { - var classes = this.classes; - var itemClasses = classes.item; - var paneClasses = classes.pane; - var table = this.s.dt; - var column = table.column( idx ); - var list = $('