3.0 beta 2

Detect the display size for paging

I am trying to implement the pagination with XML data source in AW 2.0.1. Instead of setting a fixed width and height, I'd like to see my grid in a fluid layout mode. That is, the grid should grow and shrink (both width and height) based on the document's real estate. (BTW, does min-width, min-height in CSS work for grid to setup minimum size?)

Here comes my question. If the document size changed, I need to calculate the new display size for the grid to render. Does it mean I have to set the fixed row height and manually calculate it by myself to decide how many rows can be rendered in the new grid size and fetch the data for those rows? Is there an easier way than that?

Another question is that when I manually adjust the grid size by setting the css property of the grid (document.getElementById('mygrid').style.height = adjustHeight();), it works perfectly in Firefox, but in IE, especially in IE6, it hangs. The simple code snippet is like the following:

<script type="text/javascript">
function adjustSize() {
document.getElementById('myGrid').style.height = [calculate the height...] + 'px';
<body onload="adjustSize()" onresize="adjustSize()">
<script type="text/javascript">
var grid = new AW.UI.Grid;

Any idea? Thanks in advance for your helps.
July 3,
I don't know any easier way to do that...

BTW, IE6 does not support min-width or min-height.

The problem with your code could be due to that setting grid height triggers resize event on the grid element. The event bubbles up and triggers adjustSize() call with body onresize handler and you have endless loop. Firefox does not have resize events on divs/spans so the code will work fine in FF but not IE.
Alex (ActiveWidgets)
July 3,
Hi, Alex:

Thanks for the prompt answer. In the endless loop case, what is the solution to stop event bubbling from grid in IE? Or you can point me to some references. I am kind of new to Javascript world and the AW codebase is my bible to learn Javascript techniques for now :-)

For the pagination question, is it better to extend AW.XML.Table and do the tweak over there? (Fetching specific row set with XPath, etc.)

Also, we (our company) purchased AW 2.0.1. What's the official way to upgrade it to 2.0.2?

Many thanks,
July 3,
If you have time, can you reply my questions? Thanks!
July 5,
To stop endless loop you have to check where the event comes from - there is a property srcElement of the global event object (in IE) -


Not sure what is the best way to do pagination. You may need to extend both the datasource and the grid object.

For the upgrade email sales @ activewidgets.com and I will send you the download link.
Alex (ActiveWidgets)
July 5,

This topic is archived.

See also:

Back to support forum


Version 2

Looking for AW 2.6 ?
The old site is here.