ParamQuery grid support forum
General Category => ParamQuery Pro Evaluation Support => Topic started by: adam on January 21, 2022, 06:34:33 am
-
Hi,
there is an error while refreshing after the onWindowResize() event is called.
->'Uncaught TypeError: Cannot read property 'wdCenter' of undefined' error is called.
Uncaught TypeError: Cannot read property 'wdCenter' of undefined
at pq.cRenderBody.refreshColumnWidths
Could you tell me if this is a bug or I'm doing something wrong?
-
Mentioned error is not reproducible so kindly share a jsfiddle so that it can be looked into.
-
A number of people have reported this error, and I ran into it myself.
After a series of tests, looking at issues like the presence of tables in iframes and so on, I finally tracked down the culprit (at least in my case):
I was putting multiple tables into jQuery tabs on the page, using the jQuery UI function described here: https://jqueryui.com/tabs/
Having multiple tables on a page in these jQuery tabs in some way triggers the "wdCenter" error. Simply removing those tabs makes the error go away. Most likely, Paramquery is using this jQuery UI function for its tabbed tables. (That approach might work for some ... letting Paramquery handle the tabs ... but in our case some of the tabs on the page don't contain tables.)
The solution is using a different approach to setting up page tabs without using that jQuery UI function (there are a number of other ways to accomplish the same UI effect.)
-
Hi ronrosell
Thanks for your detailed feedback. ParamQuery doesn't use jQueryUI tabs for its inbuilt tabs UI.
To get rid of the error, please ensure to call refresh on the grids whenever corresponding jQueryUI tab is activated.
Example of Pqgrid in jQueryUI tab: https://paramquery.com/pro/demos/tabs
$("#tabs").tabs({
activate: function (evt, ui) {
ui.newPanel.find(".pq-grid").pqGrid( 'refresh' );
}
});
-
Thanks for the suggestion Paramvir,
Just to be sure that I understand the mechanism at work here, does this mean that the table doesn't render if it's loaded into a DIV (or, in our case, an iframe within a DIV) that's not visible (css display:none), hence the need to call refresh?
Ron
-
Hi Ron
You got it right. If grid's parent / ancestor is hidden or display:none, then grid table doesn't render. It needs to be refreshed when its state transitions from hidden to visible.
Auto detection of change in visibility state and auto refresh might be added in upcoming versions of pqgrid but till then it has to be done manually.
-
Makes sense, and it's easy enough to work within that constraint. Thank you Paramvir! You've got a great product here.