Author Topic: Override "showLoading"  (Read 72 times)

jplevene

  • Pro Ultimate
  • Full Member
  • *
  • Posts: 126
    • View Profile
Override "showLoading"
« on: October 26, 2024, 12:00:14 am »
I want to override showLoading and hideLoading for all pqGrids that I define after I call below.  Is the following correct?

Code: [Select]
var fn = $.paramquery._pqGrid.prototype;
fn.showLoading = function() {
console.log("showLoading");
this.loading = true;
open_loading_overlay();
};
fn.hideLoading = function() {
console.log("hideLoading");
this.loading = false;
close_loading_overlay();
};
« Last Edit: October 26, 2024, 12:28:05 am by jplevene »

jplevene

  • Pro Ultimate
  • Full Member
  • *
  • Posts: 126
    • View Profile
Re: Override "showLoading"
« Reply #1 on: October 26, 2024, 06:17:51 pm »
I modified the functions slightly due to a "bug"

Code: [Select]
(function($) {
var fn = $.paramquery._pqGrid.prototype;
fn.showLoading = function() {
//console.log("showLoading", this);
if(this.$grid_center.is(":visible"))
{
this.loading = true;
open_loading_overlay();
}
};
fn.hideLoading = function() {
//console.log("hideLoading");
this.loading = false;
close_loading_overlay();
};
})(jQuery);

If the grid is hidden and the screen size changes, for some reason "showLoading" was getting called, so I had to add the "if" statement.