Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I've often heard requests for an extension that can center align a QlikView document, and I recently built one for the Global Games app.
One difference between that one and the one I'm posting here, is that that version also places a new background image on the page.
So, non-technically, this extension will take your app and align it to the center of the window, including the tabs. It also centers any background image on the app as well, so if you have a background image that is wider than the content area of the app, it could cause that background image to look strange.
A little more technically...since QV uses all absolutely positioned elements, it's difficult to determine the width of the content area, but I was able to do that in this extension in order to center it. The one issue is that if there is a smaller width the content area, it will center based on that small area and look strange. So, the default width that it sets the document to is 1024 pixels. If the extension determines the app is wider, it will center properly for that width.
Even more technically...all the extension is really doing is wrapping the content area (the PageContainer div) inside a div with a class of "master." Then, the extension just determines the content area width, and centers that content in the master div.
ANYway, hopefully this helps some people out. I haven't tested in QVS yet, but it should work in QVS also.
Thanks.
EDIT: I modified the extension I originally posted to ensure the aligning updates when switching between sheets of different widths.
Any reason this extension won't stay active? I move centerAlign into the Active Extensions area, hit Apply and OK, but once I switch into WebView nothing is centered and when I go back to the Extensions tab under Document Properties and the extension has moved back into Installed Extensions. Any ideas?
Love the extension, thanks for sharing!!
Tim,
Did you ever manage to solve that problem? Tried renaming the function etc but I am finding once applying this extension with other extensions it automatically disables.
I realize this is 6 months old, and I apologize, but I'm wondering if this was ever fixed. I noticed that this extension could have problems playing nice with other document extensions.
I've tried modifying the code, re-writing it and the issue still remains. Are you allowed to call the SetOnUpdateComplete function more than once?
I had thought so...
When you run the centerAlign by itself (with no other doc extensions), it works, right?
Yup, as soon as I assign another extension to the list centreAlign removes itself.