I want to override functions calcTopBottom, getTop, getLeft, etc. which is in window.pq.cVirtual.
I am using the jQuery version of pqGid, so to overwrite some functions I use the following which works fine:
(function($) {
var fn = $.paramquery._pqGrid.prototype;
fn.showLoading = function() {
if(this.$grid_center.is(":visible"))
{
this.loading = true;
open_loading_overlay();
}
};
fn.hideLoading = function() {
this.loading = false;
close_loading_overlay();
};
})(jQuery);
However when I want to override cVirtual functions, to test this I do the following:
var cVirtual = window.pq.cVirtual.prototype;
cVirtual.calcTopBottom = function(left) {
console.log("calcTopBottom");
// Call the old
return cVirtual.calcTopBottom(left);
};
cVirtual.getTop = function(ri, actual) {
console.log("getTop");
// Call the old
return cVirtual.getTop(ri, actual);
};
cVirtual.getLeft = function(ci, actual) {
console.log("getLeft");
// Call the old
return cVirtual.getLeft(ci, actual);
};
cVirtual.getHeightR = function(ri, rows) {
console.log("getHeightR");
// Call the old
return cVirtual.getHeightR(ri, rows);
};
cVirtual.calInitFinal = function(top, bottom, left) {
console.log("calInitFinal");
// Call the old
return cVirtual.calInitFinal(top, bottom, left);
};
However the above functions are never called. What am I doing wrong?