CC-4282: Library ->"Uploaded From" -> Submitting data in wrong format causes "Processing ..." message pop up for a while
-implemented advanced search validation -data only gets sent to server if all fields are valid
This commit is contained in:
parent
0ab08af48f
commit
8520141240
2 changed files with 181 additions and 33 deletions
|
@ -103,7 +103,8 @@
|
|||
label = label.replace(/(^\s*)|(\s*$)/g, "");
|
||||
var currentFilter = oTable.fnSettings().aoPreSearchCols[i].sSearch;
|
||||
var search_init = 'search_init ';
|
||||
var inputvalue = label;
|
||||
//var inputvalue = label;
|
||||
var inputvalue = '';
|
||||
if (currentFilter != '' && currentFilter != '^') {
|
||||
if (bIsNumber && currentFilter.charAt(0) == '^')
|
||||
inputvalue = currentFilter.substr(1); //ignore trailing ^
|
||||
|
@ -133,29 +134,32 @@
|
|||
});
|
||||
} else {
|
||||
input.keyup(function () {
|
||||
if (oTable.fnSettings().oFeatures.bServerSide && iFilterLength != 0) {
|
||||
//If filter length is set in the server-side processing mode
|
||||
//Check has the user entered at least iFilterLength new characters
|
||||
|
||||
var currentFilter = oTable.fnSettings().aoPreSearchCols[index].sSearch;
|
||||
var iLastFilterLength = $(this).data("dt-iLastFilterLength");
|
||||
if (typeof iLastFilterLength == "undefined")
|
||||
iLastFilterLength = 0;
|
||||
var iCurrentFilterLength = this.value.length;
|
||||
if (Math.abs(iCurrentFilterLength - iLastFilterLength) < iFilterLength
|
||||
//&& currentFilter.length == 0 //Why this?
|
||||
) {
|
||||
//Cancel the filtering
|
||||
return;
|
||||
}
|
||||
else {
|
||||
//Remember the current filter length
|
||||
$(this).data("dt-iLastFilterLength", iCurrentFilterLength);
|
||||
var advSearchFields = $("div#advanced_search").children(':visible');
|
||||
if(validateAdvancedSearch(advSearchFields)){
|
||||
if (oTable.fnSettings().oFeatures.bServerSide && iFilterLength != 0) {
|
||||
//If filter length is set in the server-side processing mode
|
||||
//Check has the user entered at least iFilterLength new characters
|
||||
|
||||
var currentFilter = oTable.fnSettings().aoPreSearchCols[index].sSearch;
|
||||
var iLastFilterLength = $(this).data("dt-iLastFilterLength");
|
||||
if (typeof iLastFilterLength == "undefined")
|
||||
iLastFilterLength = 0;
|
||||
var iCurrentFilterLength = this.value.length;
|
||||
if (Math.abs(iCurrentFilterLength - iLastFilterLength) < iFilterLength
|
||||
//&& currentFilter.length == 0 //Why this?
|
||||
) {
|
||||
//Cancel the filtering
|
||||
return;
|
||||
}
|
||||
else {
|
||||
//Remember the current filter length
|
||||
$(this).data("dt-iLastFilterLength", iCurrentFilterLength);
|
||||
}
|
||||
}
|
||||
/* Filter on the column (the index) of this element */
|
||||
oTable.fnFilter(this.value, _fnColumnIndex(index), regex, smart); //Issue 37
|
||||
fnOnFiltered();
|
||||
}
|
||||
/* Filter on the column (the index) of this element */
|
||||
oTable.fnFilter(this.value, _fnColumnIndex(index), regex, smart); //Issue 37
|
||||
fnOnFiltered();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -168,7 +172,8 @@
|
|||
input.blur(function () {
|
||||
if (this.value == "") {
|
||||
$(this).addClass("search_init");
|
||||
this.value = asInitVals[index];
|
||||
//this.value = asInitVals[index];
|
||||
this.value = "";
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -228,14 +233,16 @@
|
|||
|
||||
|
||||
$('#' + sFromId + ',#' + sToId, th).keyup(function () {
|
||||
|
||||
var iMin = document.getElementById(sFromId).value * 1;
|
||||
var iMax = document.getElementById(sToId).value * 1;
|
||||
if (iMin != 0 && iMax != 0 && iMin > iMax)
|
||||
return;
|
||||
|
||||
oTable.fnDraw();
|
||||
fnOnFiltered();
|
||||
var advSearchFields = $("div#advanced_search").children(':visible');
|
||||
if(validateAdvancedSearch(advSearchFields)){
|
||||
var iMin = document.getElementById(sFromId).value * 1;
|
||||
var iMax = document.getElementById(sToId).value * 1;
|
||||
if (iMin != 0 && iMax != 0 && iMin > iMax)
|
||||
return;
|
||||
|
||||
oTable.fnDraw();
|
||||
fnOnFiltered();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue