Hi Jarnis,
We have a similar challenge: we determine pageable views' itemsPerPage
based on available screen height. Since many of our pages have such views,
we include JavaScript in each page that stores the current known height,
and reports back any changes with jQuery (after a slight delay).
window.trackerHeight = <current known size>;
window.trackerTimeout = null;
var updateSize = function() {
$.ajax({url:'/XXX/height?h=' + $(window).height()});
};
$(window).resize(function() {
if(window.trackerHeight != $(window).height()) {
window.trackerHeight = $(window).height();
clearTimeout(window.trackerTimeout);
window.trackerTimeout = setTimeout(updateSize, 3000);
}
});
updateSize();
The "height" Wicket resource puts the value in the Session. The dynamically
sized component then just needs to know the number of height pixels to
reserve for other content, and uses up the remainder. And yes, this
reserved height, and the height-per-row are static finals in Java. :)
This works well for us, but may be overkill for you. It also violates your
no-AJAX and no-jQuery goals.
HTH,
Dan
On Thu, Mar 8, 2012 at 8:57 AM, jarnis <[email protected]> wrote:
>
> Martin Grigorov-4 wrote
> >
> > Maybe you do this with the WebClientInfo.
> >
> Using WebClientInfo does seem to offer a possible workaround. However, as I
> see it, there are a few drawbacks:
>
> It requires the Java code to know the percentage of the page that the
> panel's div is taking. Hard-coding this would be a bit against the purpose
> of wicket (as I understand it) as it would depend on the html/css not
> changing and thereby limit the freedom of the designers. It might be
> possible to get this info programatically however, I have not yet
> investigated this. In this case where I am both programmer and designer,
> the
> actual problem would not be that great.
>
> It seems the WebClientInfo is not updated when the browser window is
> resized. There may be a way to force this, I have not yet checked this
> throughly.
>
> If no better solution is possible, this can definitely be used. I would
> still like a solution that fit a little better with Wicket's spirit.
>
> In any case, thanks a lot for your suggestion, Martin
>
> Jarnis
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Dynamically-sized-image-tp4456657p4456981.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>