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+
|
* requires: tableSorter 2.7.7+ and jQuery 1.4.3+
|
||||||
*
|
*
|
||||||
* jQuery UI spinner
|
* uiSpinner (jQuery UI spinner)
|
||||||
* jQuery UI slider
|
* uiSlider (jQuery UI slider)
|
||||||
* jQuery UI range slider
|
* uiRange (jQuery UI range slider)
|
||||||
* jQuery UI datepicker (range)
|
* uiDateCompare (jQuery UI datepicker; 1 input)
|
||||||
* HTML5 number (spinner)
|
* uiDatepicker (jQuery UI datepicker; 2 inputs, filter range)
|
||||||
* HTML5 range slider
|
* html5Number (spinner)
|
||||||
* HTML5 color selector
|
* html5Range (slider)
|
||||||
|
* html5Color (color)
|
||||||
*/
|
*/
|
||||||
/*jshint browser:true, jquery:true, unused:false */
|
/*jshint browser:true, jquery:true, unused:false */
|
||||||
/*global jQuery: false */
|
/*global jQuery: false */
|
||||||
@ -248,7 +249,7 @@ $.tablesorter.filterFormatter = {
|
|||||||
// make sure we're using parsed dates in the search
|
// make sure we're using parsed dates in the search
|
||||||
$hdr.addClass('filter-parsed');
|
$hdr.addClass('filter-parsed');
|
||||||
// Add date range picker
|
// 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
|
// add callbacks; preserve added callbacks
|
||||||
o.oldonClose = o.onClose;
|
o.oldonClose = o.onClose;
|
||||||
|
@ -547,7 +547,9 @@ ts.addWidget({
|
|||||||
buildSelect = function(i, updating, onlyavail){
|
buildSelect = function(i, updating, onlyavail){
|
||||||
var o, t, arry = [], currentVal;
|
var o, t, arry = [], currentVal;
|
||||||
i = parseInt(i, 10);
|
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++ ){
|
for (k = 0; k < b.length; k++ ){
|
||||||
l = c.cache[k].row.length;
|
l = c.cache[k].row.length;
|
||||||
// loop through the rows
|
// loop through the rows
|
||||||
@ -651,7 +653,7 @@ ts.addWidget({
|
|||||||
t = $('<input type="search">').appendTo( c.$filters.eq(i) );
|
t = $('<input type="search">').appendTo( c.$filters.eq(i) );
|
||||||
}
|
}
|
||||||
if (t) {
|
if (t) {
|
||||||
t.attr('placeholder', $th.attr('data-placeholder') || '');
|
t.attr('placeholder', $th.data('placeholder') || $th.attr('data-placeholder') || '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (t) {
|
if (t) {
|
||||||
@ -715,7 +717,7 @@ ts.addWidget({
|
|||||||
// add custom drop down list
|
// add custom drop down list
|
||||||
for (str in wo.filter_functions[col]){
|
for (str in wo.filter_functions[col]){
|
||||||
if (typeof str === 'string'){
|
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>';
|
ff += '<option value="' + str + '">' + str + '</option>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user