Lines 511-516
jQuery.fn.dataTable.ext.errMode = function(settings, note, message) {
Link Here
|
511 |
|
511 |
|
512 |
$.fn.api = function(options, columns_settings, add_filters) { |
512 |
$.fn.api = function(options, columns_settings, add_filters) { |
513 |
var settings = null; |
513 |
var settings = null; |
|
|
514 |
|
515 |
if ( add_filters ) { |
516 |
$(this).find('thead tr').clone(true).appendTo( $(this).find('thead') ); |
517 |
} |
518 |
|
514 |
if(options) { |
519 |
if(options) { |
515 |
if(!options.criteria || ['contains', 'starts_with', 'ends_with', 'exact'].indexOf(options.criteria.toLowerCase()) === -1) options.criteria = 'contains'; |
520 |
if(!options.criteria || ['contains', 'starts_with', 'ends_with', 'exact'].indexOf(options.criteria.toLowerCase()) === -1) options.criteria = 'contains'; |
516 |
options.criteria = options.criteria.toLowerCase(); |
521 |
options.criteria = options.criteria.toLowerCase(); |
Lines 714-730
jQuery.fn.dataTable.ext.errMode = function(settings, note, message) {
Link Here
|
714 |
} |
719 |
} |
715 |
); |
720 |
); |
716 |
|
721 |
|
|
|
722 |
$(".dt_button_clear_filter, .columns_controls, .export_controls").tooltip(); |
723 |
|
717 |
if ( add_filters ) { |
724 |
if ( add_filters ) { |
718 |
// Duplicate the table header row for columnFilter |
725 |
settings['orderCellsTop'] = true; |
719 |
thead_row = this.find('thead tr'); |
|
|
720 |
clone = thead_row.clone().addClass('filters_row'); |
721 |
clone.find("th.NoSort").html(''); |
722 |
thead_row.before(clone); |
723 |
} |
726 |
} |
724 |
|
727 |
|
725 |
$(".dt_button_clear_filter, .columns_controls, .export_controls").tooltip(); |
728 |
var table = $(this).dataTable(settings); |
|
|
729 |
|
730 |
if ( add_filters ) { |
731 |
var table_dt = table.DataTable(); |
732 |
$(this).find('thead tr:eq(1) th').each( function (i) { |
733 |
var is_searchable = table_dt.settings()[0].aoColumns[i].bSearchable; |
734 |
if ( is_searchable ) { |
735 |
var title = $(this).text(); |
736 |
var search_title = _("Search %s").format(title); |
737 |
$(this).html( '<input type="text" placeholder="%s" />'.format(search_title) ); |
738 |
|
739 |
$( 'input', this ).on( 'keyup change', function () { |
740 |
if ( table_dt.column(i).search() !== this.value ) { |
741 |
table_dt |
742 |
.column(i) |
743 |
.search( this.value ) |
744 |
.draw(); |
745 |
} |
746 |
} ); |
747 |
} else { |
748 |
$(this).html(''); |
749 |
} |
750 |
} ); |
751 |
} |
726 |
|
752 |
|
727 |
return $(this).dataTable(settings); |
753 |
return table; |
728 |
}; |
754 |
}; |
729 |
|
755 |
|
730 |
})(jQuery); |
756 |
})(jQuery); |
731 |
- |
|
|