3.2.0

scroll error on 2.5.2 combo box

I posted this error 2 weeks ago.

In 2.5.1, I used the following code to keep the selected item on the top of the popup list:

ddl.showPopup1 = ddl.showPopup;
ddl.showPopup = function(){
this.showPopup1();
this.getViewTemplate().element().parentNode.scrollTop = this.getCurrentItem()*16;
}

It worked fine in 2.5.1, but not work in 2.5.2. To trace the error, I change the last line of code like

this.getViewTemplate().element().parentNode.scrollTop = 160;// (or whatever numbers here)
alert(this.getViewTemplate().element().parentNode.scrollTop);

The alert displays 0 at initial, and then, always displays 32 afterward.

Should I change something to adopt 2.5.2?

Thanks,
mrhsh
July 21,
I guess you need to add some delay. AW 2.5.1 tried to calculate the popup size immediately after creating it and this triggered many errors due to network latency (loading stylesheets with caching disabled). Now AW 2.5.2 waits until the page is fully loaded before resizing the popup window, and this is why you may have this scrollTop error.
Alex (ActiveWidgets)
July 21,
Thanks Alex! Instead of adding delay, I worked it around by resizing the popup before setting the scroll position, as following:

ddl.showPopup1 = ddl.showPopup;
ddl.showPopup = function(){
this.showPopup1();
this.getPopupTemplate().setSize(200,500);//this is an add-on to make the following line to work.
this.getViewTemplate().element().parentNode.scrollTop = this.getCurrentItem()*16;
}

This is a solution although the code looks a little weired.
mrhsh
July 21,

This topic is archived.

See also:


Back to support forum