CC-4486: Library -> Advanced Search: Alignment is off sometimes

-added placeholders to input tags for format examples
This commit is contained in:
denise 2012-10-04 12:16:57 -04:00
parent 5a0df2b6d5
commit 0d35056cd4
3 changed files with 60 additions and 19 deletions

View File

@ -378,16 +378,6 @@ var AIRTIME = (function(AIRTIME) {
$.each(aoCols, function(i,ele){
if (ele.bSearchable) {
var currentColId = ele._ColReorder_iOrigCol;
var label = "";
if (ele.mDataProp == "bit_rate") {
label = " (bps)";
} else if (ele.mDataProp == "utime" || ele.mDataProp == "mtime" || ele.mDataProp == "lptime") {
label = " (yyyy-mm-dd)";
} else if (ele.mDataProp == "length") {
label = " (hh:mm:ss.t)";
} else if (ele.mDataProp == "sample_rate") {
label = " (Hz)";
}
var inputClass = 'filter_column filter_number_text';
var labelStyle = "style='margin-right:35px;'";
@ -397,9 +387,17 @@ var AIRTIME = (function(AIRTIME) {
}
if (ele.bVisible) {
advanceSearchDiv.append("<div id='advanced_search_col_"+currentColId+" class='control-group'><label class='control-label'"+labelStyle+">"+ele.sTitle+label+" : </label><div id='"+ele.mDataProp+"' class='controls "+inputClass+"'></div></div>");
advanceSearchDiv.append(
"<div id='advanced_search_col_"+currentColId+" class='control-group'>" +
"<label class='control-label'"+labelStyle+">"+ele.sTitle+" : </label>" +
"<div id='"+ele.mDataProp+"' class='controls "+inputClass+"'></div>" +
"</div>");
} else {
advanceSearchDiv.append("<div id='advanced_search_col_"+currentColId+"' class='control-group' style='display:none;'><label class='control-label'"+labelStyle+">"+ele.sTitle+label+"</label><div id='"+ele.mDataProp+"' class='controls "+inputClass+"'></div></div>");
advanceSearchDiv.append(
"<div id='advanced_search_col_"+currentColId+"' class='control-group' style='display:none;'>" +
"<label class='control-label'"+labelStyle+">"+ele.sTitle+"</label>" +
"<div id='"+ele.mDataProp+"' class='controls "+inputClass+"'></div>" +
"</div>");
}
if (criteriaTypes[ele.mDataProp] == "s") {

View File

@ -5,8 +5,8 @@ Running a diff between the original column filter plugin (dataTables.columnFilte
our modified one (dataTables.columnFilter.js):
denise@denise-DX4860:~/airtime/airtime_mvc/public/js/datatables/plugin$ diff -u dataTables.columnFilter_orig.js dataTables.columnFilter.js
--- dataTables.columnFilter_orig.js 2012-09-10 14:26:30.041095663 -0400
+++ dataTables.columnFilter.js 2012-09-10 17:04:21.017464447 -0400
--- dataTables.columnFilter_orig.js 2012-09-11 11:53:16.476101955 -0400
+++ dataTables.columnFilter.js 2012-10-04 12:15:13.270199949 -0400
@@ -103,7 +103,8 @@
label = label.replace(/(^\s*)|(\s*$)/g, "");
var currentFilter = oTable.fnSettings().aoPreSearchCols[i].sSearch;
@ -32,7 +32,7 @@ denise@denise-DX4860:~/airtime/airtime_mvc/public/js/datatables/plugin$ diff -u
- var iCurrentFilterLength = this.value.length;
- if (Math.abs(iCurrentFilterLength - iLastFilterLength) < iFilterLength
- //&& currentFilter.length == 0 //Why this?
- ) {
- ) {
- //Cancel the filtering
- return;
- }
@ -52,7 +52,7 @@ denise@denise-DX4860:~/airtime/airtime_mvc/public/js/datatables/plugin$ diff -u
+ var iCurrentFilterLength = this.value.length;
+ if (Math.abs(iCurrentFilterLength - iLastFilterLength) < iFilterLength
+ //&& currentFilter.length == 0 //Why this?
+ ) {
+ ) {
+ //Cancel the filtering
+ return;
+ }
@ -81,7 +81,35 @@ denise@denise-DX4860:~/airtime/airtime_mvc/public/js/datatables/plugin$ diff -u
}
});
}
@@ -228,14 +233,16 @@
@@ -176,13 +181,25 @@
function fnCreateRangeInput(oTable) {
//var currentFilter = oTable.fnSettings().aoPreSearchCols[i].sSearch;
+
+ var label = "";
+ if (th.attr('id') == "bit_rate") {
+ label = " bps";
+ } else if (th.attr('id') == "utime" || th.attr('id') == "mtime" || th.attr('id') == "lptime") {
+ label = " yyyy-mm-dd";
+ } else if (th.attr('id') == "length") {
+ label = " hh:mm:ss.t";
+ } else if (th.attr('id') == "sample_rate") {
+ label = " Hz";
+ }
+
th.html(_fnRangeLabelPart(0));
var sFromId = oTable.attr("id") + '_range_from_' + i;
- var from = $('<input type="text" class="number_range_filter" id="' + sFromId + '" rel="' + i + '"/>');
+ var from = $('<input type="text" class="number_range_filter" id="' + sFromId + '" rel="' + i + '" placeholder="' + label + '"/>');
th.append(from);
th.append(_fnRangeLabelPart(1));
var sToId = oTable.attr("id") + '_range_to_' + i;
- var to = $('<input type="text" class="number_range_filter" id="' + sToId + '" rel="' + i + '"/>');
+ var to = $('<input type="text" class="number_range_filter" id="' + sToId + '" rel="' + i + '" placeholder="' + label + '"/>');
th.append(to);
th.append(_fnRangeLabelPart(2));
th.wrapInner('<span class="filterColumn filter_number_range" />');
@@ -228,14 +245,16 @@
$('#' + sFromId + ',#' + sToId, th).keyup(function () {
@ -106,3 +134,6 @@ denise@denise-DX4860:~/airtime/airtime_mvc/public/js/datatables/plugin$ diff -u
});

View File

@ -181,13 +181,25 @@
function fnCreateRangeInput(oTable) {
//var currentFilter = oTable.fnSettings().aoPreSearchCols[i].sSearch;
var label = "";
if (th.attr('id') == "bit_rate") {
label = " bps";
} else if (th.attr('id') == "utime" || th.attr('id') == "mtime" || th.attr('id') == "lptime") {
label = " yyyy-mm-dd";
} else if (th.attr('id') == "length") {
label = " hh:mm:ss.t";
} else if (th.attr('id') == "sample_rate") {
label = " Hz";
}
th.html(_fnRangeLabelPart(0));
var sFromId = oTable.attr("id") + '_range_from_' + i;
var from = $('<input type="text" class="number_range_filter" id="' + sFromId + '" rel="' + i + '"/>');
var from = $('<input type="text" class="number_range_filter" id="' + sFromId + '" rel="' + i + '" placeholder="' + label + '"/>');
th.append(from);
th.append(_fnRangeLabelPart(1));
var sToId = oTable.attr("id") + '_range_to_' + i;
var to = $('<input type="text" class="number_range_filter" id="' + sToId + '" rel="' + i + '"/>');
var to = $('<input type="text" class="number_range_filter" id="' + sToId + '" rel="' + i + '" placeholder="' + label + '"/>');
th.append(to);
th.append(_fnRangeLabelPart(2));
th.wrapInner('<span class="filterColumn filter_number_range" />');