mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-11-15 23:54:22 +00:00
filter placeholder text can now be obtained from jQuery data
This commit is contained in:
parent
61ae505fac
commit
17ebc25fbb
@ -1,13 +1,14 @@
|
||||
/*! Filter widget formatter functions - updated 5/8/2013
|
||||
/*! Filter widget formatter functions - updated 5/24/2013
|
||||
* requires: tableSorter 2.7.7+ and jQuery 1.4.3+
|
||||
*
|
||||
* jQuery UI spinner
|
||||
* jQuery UI slider
|
||||
* jQuery UI range slider
|
||||
* jQuery UI datepicker (range)
|
||||
* HTML5 number (spinner)
|
||||
* HTML5 range slider
|
||||
* HTML5 color selector
|
||||
* uiSpinner (jQuery UI spinner)
|
||||
* uiSlider (jQuery UI slider)
|
||||
* uiRange (jQuery UI range slider)
|
||||
* uiDateCompare (jQuery UI datepicker; 1 input)
|
||||
* uiDatepicker (jQuery UI datepicker; 2 inputs, filter range)
|
||||
* html5Number (spinner)
|
||||
* html5Range (slider)
|
||||
* html5Color (color)
|
||||
*/
|
||||
/*jshint browser:true, jquery:true, unused:false */
|
||||
/*global jQuery: false */
|
||||
@ -248,7 +249,7 @@ $.tablesorter.filterFormatter = {
|
||||
// make sure we're using parsed dates in the search
|
||||
$hdr.addClass('filter-parsed');
|
||||
// Add date range picker
|
||||
$('<span>' + o.cellText + '<input type="text" class="date" placeholder="' + $hdr.attr('data-placeholder') + '" />').appendTo($cell);
|
||||
$('<span>' + o.cellText + '<input type="text" class="date" placeholder="' + ($hdr.data('placeholder') || $hdr.attr('data-placeholder') || '') + '" />').appendTo($cell);
|
||||
|
||||
// add callbacks; preserve added callbacks
|
||||
o.oldonClose = o.onClose;
|
||||
|
@ -547,7 +547,9 @@ ts.addWidget({
|
||||
buildSelect = function(i, updating, onlyavail){
|
||||
var o, t, arry = [], currentVal;
|
||||
i = parseInt(i, 10);
|
||||
o = '<option value="">' + ($ths.filter('[data-column="' + i + '"]:last').attr('data-placeholder') || '') + '</option>';
|
||||
t = $ths.filter('[data-column="' + i + '"]:last');
|
||||
// t.data('placeholder') won't work in jQuery older than 1.4.3
|
||||
o = '<option value="">' + (t.data('placeholder') || t.attr('data-placeholder') || '') + '</option>';
|
||||
for (k = 0; k < b.length; k++ ){
|
||||
l = c.cache[k].row.length;
|
||||
// loop through the rows
|
||||
@ -651,7 +653,7 @@ ts.addWidget({
|
||||
t = $('<input type="search">').appendTo( c.$filters.eq(i) );
|
||||
}
|
||||
if (t) {
|
||||
t.attr('placeholder', $th.attr('data-placeholder') || '');
|
||||
t.attr('placeholder', $th.data('placeholder') || $th.attr('data-placeholder') || '');
|
||||
}
|
||||
}
|
||||
if (t) {
|
||||
@ -715,7 +717,7 @@ ts.addWidget({
|
||||
// add custom drop down list
|
||||
for (str in wo.filter_functions[col]){
|
||||
if (typeof str === 'string'){
|
||||
ff += ff === '' ? '<option value="">' + (t.attr('data-placeholder') || '') + '</option>' : '';
|
||||
ff += ff === '' ? '<option value="">' + (t.data('placeholder') || t.attr('data-placeholder') || '') + '</option>' : '';
|
||||
ff += '<option value="' + str + '">' + str + '</option>';
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user