bProcessing Usage
bProcessing Usage
lnardozi
Posts: 1Questions: 0Answers: 0
I wanted the 'processing' message to appear when filtering since we're working with large client result sets. I made the following change to _fnFilterComplete to accomplish this:
[code]
function _fnFilterComplete ( oSettings, oInput, iForce ) {
var fnInnerFiltering = function() {
var oPrevSearch = oSettings.oPreviousSearch;
var aoPrevSearch = oSettings.aoPreSearchCols;
var fnSaveFilter = function(oFilter) {
/* Save the filtering values */
oPrevSearch.sSearch = oFilter.sSearch;
oPrevSearch.bRegex = oFilter.bRegex;
oPrevSearch.bSmart = oFilter.bSmart;
oPrevSearch.bCaseInsensitive = oFilter.bCaseInsensitive;
};
/* In server-side processing all filtering is done by the server, so no point hanging around here */
if (!oSettings.oFeatures.bServerSide) {
/* Global filter */
_fnFilter(oSettings, oInput.sSearch, iForce, oInput.bRegex, oInput.bSmart, oInput.bCaseInsensitive);
fnSaveFilter(oInput);
/* Now do the individual column filter */
for (var i = 0; i < oSettings.aoPreSearchCols.length; i++) {
_fnFilterColumn(oSettings, aoPrevSearch[i].sSearch, i, aoPrevSearch[i].bRegex,
aoPrevSearch[i].bSmart, aoPrevSearch[i].bCaseInsensitive);
}
/* Custom filtering */
_fnFilterCustom(oSettings);
} else {
fnSaveFilter(oInput);
}
/* Tell the draw function we have been filtering */
oSettings.bFiltered = true;
$(oSettings.oInstance).trigger('filter', oSettings);
/* Redraw the table */
oSettings._iDisplayStart = 0;
_fnCalculateEnd(oSettings);
_fnDraw(oSettings);
/* Rebuild search array 'offline' */
_fnBuildSearchArray(oSettings, 0);
};
if (!oSettings.oFeatures.bProcessing) {
fnInnerFiltering();
}
else {
_fnProcessingDisplay(oSettings, true);
setTimeout(function () {
fnInnerFiltering();
if (!oSettings.oFeatures.bServerSide) {
_fnProcessingDisplay(oSettings, false);
}
}, 50);
}
}
[/code]
Also, in my project (which uses deferred rendering, the columnFilters plugin and scroller) the following css addition was necessary to get the Processing box to render:
.dataTables_processing{ z-index: 999;}
[code]
function _fnFilterComplete ( oSettings, oInput, iForce ) {
var fnInnerFiltering = function() {
var oPrevSearch = oSettings.oPreviousSearch;
var aoPrevSearch = oSettings.aoPreSearchCols;
var fnSaveFilter = function(oFilter) {
/* Save the filtering values */
oPrevSearch.sSearch = oFilter.sSearch;
oPrevSearch.bRegex = oFilter.bRegex;
oPrevSearch.bSmart = oFilter.bSmart;
oPrevSearch.bCaseInsensitive = oFilter.bCaseInsensitive;
};
/* In server-side processing all filtering is done by the server, so no point hanging around here */
if (!oSettings.oFeatures.bServerSide) {
/* Global filter */
_fnFilter(oSettings, oInput.sSearch, iForce, oInput.bRegex, oInput.bSmart, oInput.bCaseInsensitive);
fnSaveFilter(oInput);
/* Now do the individual column filter */
for (var i = 0; i < oSettings.aoPreSearchCols.length; i++) {
_fnFilterColumn(oSettings, aoPrevSearch[i].sSearch, i, aoPrevSearch[i].bRegex,
aoPrevSearch[i].bSmart, aoPrevSearch[i].bCaseInsensitive);
}
/* Custom filtering */
_fnFilterCustom(oSettings);
} else {
fnSaveFilter(oInput);
}
/* Tell the draw function we have been filtering */
oSettings.bFiltered = true;
$(oSettings.oInstance).trigger('filter', oSettings);
/* Redraw the table */
oSettings._iDisplayStart = 0;
_fnCalculateEnd(oSettings);
_fnDraw(oSettings);
/* Rebuild search array 'offline' */
_fnBuildSearchArray(oSettings, 0);
};
if (!oSettings.oFeatures.bProcessing) {
fnInnerFiltering();
}
else {
_fnProcessingDisplay(oSettings, true);
setTimeout(function () {
fnInnerFiltering();
if (!oSettings.oFeatures.bServerSide) {
_fnProcessingDisplay(oSettings, false);
}
}, 50);
}
}
[/code]
Also, in my project (which uses deferred rendering, the columnFilters plugin and scroller) the following css addition was necessary to get the Processing box to render:
.dataTables_processing{ z-index: 999;}
This discussion has been closed.
Replies
Allan