struts-community-plugins / struts2-jquery

Struts2 jQuery Plugin
Apache License 2.0
83 stars 49 forks source link

All grids now have a white space on the right side #327

Closed B34v0n closed 9 months ago

B34v0n commented 1 year ago

All my grids have initially some blank space on the right after the Update to Version 5.0.1. I can resize the columns to make them bigger and the space disappears. But every time I reload, the space is back. It can even be seen on the showcase for the grid Plugin and the normal showcase when the grid is chosen and it's loaded for the first time. I don't know how to fix this. My first idea was setting the "shrinkToFit" option to false, but it doesn't seem to change anything. Anybody who had/has the same problem who can help me?

white_space_grid_right

lukaszlenart commented 1 year ago

I played a bit with this issue and I have no idea what's wrong :(

lukaszlenart commented 1 year ago

I tested this issue with Struts 6.2.0-SNAPSHOT and looks like it's gone, there are some small adjustments in the plugin as well.

B34v0n commented 1 year ago

That would be great! I wasn't able to test it with the Struts 6.2.0-SNAPSHOT locally, so I will wait for the release and try it out afterwards. Thanks. :)

lukaszlenart commented 1 year ago

To fix this issue Struts 6.2.0 is needed, so I have to postpone this one.

lukaszlenart commented 1 year ago

I'm closing this, feel free to re-open if Struts 6.2.0 won't fix this (it should be released soon)

B34v0n commented 1 year ago

Hi @lukaszlenart, I was just able to test the issue again with Struts 6.2.0 and plugin Version 5.0.3. Sadly, the issue is not resolved and the whitespace is still there.

lukaszlenart commented 1 year ago

This is funny ... it only happens when you open the page for the first time, but when you switch back and forth using menu everything is fine 🤯

lukaszlenart commented 11 months ago

This only happens on first page entry or when a browser cache is disabled

B34v0n commented 9 months ago

I also noticed, that the whitespace is always there, if you open the app in a new tab (even if it is already opened in another tab)..

Could there be a timing problem, that something is not loaded in time when opened, but it's there, when a reload is triggered?

lukaszlenart commented 9 months ago

Yeah, it's a timing issue but I cannot figure it out :\

gregh3269 commented 9 months ago

In jquery.grid.struts2.js try swapping the load order

from self.require("js/base/jquery.jqGrid" + self.minSuffix + ".js"); self.requireCss("themes/ui.jqgrid.css");

to self.requireCss("themes/ui.jqgrid.css"); self.require("js/base/jquery.jqGrid" + self.minSuffix + ".js");

It works in the showcase and you don't get the initial column.

lukaszlenart commented 9 months ago

@gregh3269 would you mind opening a PR to fix that in Showcase as well?

B34v0n commented 9 months ago

Hi @gregh3269 & @lukaszlenart : I just started the showcase locally with the latest Snapshot-Version. The problem is not solved by just switching the order. The whitespace is still there. image

gregh3269 commented 9 months ago

Can you make sure you have cleared your browser cache.

image

B34v0n commented 9 months ago

Yes, I did that. And if I open the developer tools and check the option to deactivate the cache completely while they are open, the space is always visible, when I reload the site.

Keep in mind, if you navigate the site multiple times, the space goes away. But if you enter the site and directly navigate to the grid, it's there.

gregh3269 commented 9 months ago

What browser are you using? In ff cannot find a deactivate cache option. Which tab is it in?

In ff I had to go to edit settings, privacy & security, manage data and then remove by the website url.

B34v0n commented 9 months ago

I'm using Chrome, but I see the space in Firefox and Edge as well. You can deacitve it in the network-analysis tab (sorry, if that's not exactly what it's called, I use the tools in german.) Here is a (german) Screenshot: image If you check that box, the cache is disabled while the devtools are open

gregh3269 commented 9 months ago

For me its working in the showcase on the very first page show (which it did not do before). So its now difficult to try and debug it.

I did have trouble with the caching to make sure it was cleared, and the only way I could do it was in the settings and to delete it. Sometimes it would show the storage as clear, but even then deleting it was the only option.

Screenshot from 2023-12-12 11-26-37

Another check is to enable compressed="false" and ajaxcache="false" on the sj:head and then check it with dev tools to see its using the latest version.

B34v0n commented 9 months ago

Strange thing: in FF-Developer Edition, it works. In every normal browser, it doesn't. Can you try in normal Firefox?

gregh3269 commented 9 months ago

115.5.0esr works OK for me, also developer 121.0b9. But then I cleared manually the storage.

...I checked in dev tools and could not find the string jquery.jqGrid or query.grid.struts2.js source.

It uses .require which was cache:true and includes it on the page and in the site data/storage. We changed this now to use the ajaxcache="true/false" which makes it easier to debug with console.log messages.

The default is cache:false (from the head.ftl), maybe now in prod want ajaxcache="true" on sj:head. True shows the storage in settings, but not in dev tools

image