PDA

View Full Version : [CLOSED] [2.1] ValidationStatus plugin scrolling the document up.



FVNoel
Jul 11, 2013, 1:57 PM

Daniil
Jul 11, 2013, 4:13 PM
Hi @FVNoel,

I can suggest to maintain scroll position this way.


Ext.ux.statusbar.ValidationStatus.override({
onFieldValidation: function (f, isValid) {
var me = this,
msg,
formPanelBody = me.statusBar.up("form").body,
scroll = formPanelBody.getScroll();

if (!me.monitor) {
return false;
}

msg = f.getErrors()[0];
if (msg) {
me.errors.add(f.id, { field: f, msg: msg });
} else {
me.errors.removeAtKey(f.id);
}

this.updateErrorList();
if (me.errors.getCount() > 0) {
if (me.statusBar.getText() !== me.showText) {
me.statusBar.setStatus({
text: me.showText,
iconCls: me.errorIconCls
});
}
} else {
me.statusBar.clearStatus().setIcon(me.validIconCls );
}

formPanelBody.setScrollTop(scroll.top);
formPanelBody.setScrollLeft(scroll.left);
}
});

FVNoel
Jul 12, 2013, 7:27 AM
What should me.statusBar.up("form").body return?

I'm getting:

TypeError: Object [object Object] has no method 'setScrollTop'

In this line:

formPanelBody.setScrollTop(scroll.top);

FVNoel
Jul 12, 2013, 7:31 AM
OK, replaced it with



formPanelBody.scrollTo('top', scroll.top);
formPanelBody.scrollTo('side', scroll.left);


and it worked. Thank you!

Daniil
Jul 12, 2013, 7:35 AM
The setScrollTop and setScrollLeft methods appeared in ExtJS 4.2.0 and, therefore, in Ext.NET v2.2.

Now I noticed the [2.1] tag in the thread's title.

So, please try to replace

formPanelBody.setScrollTop(scroll.top);
formPanelBody.setScrollLeft(scroll.left);
with

formPanelBody.scroll('top', scroll.top);
formPanelBody.scroll(left, scroll.left);

FVNoel
Jul 12, 2013, 10:26 AM
Ok, I'm still having issues with certain fields that hide or show a component. For example, if I add a listener like this:



<ext:TextArea LabelWidth="180" runat="server" ID="txtAnamnesisOtrasObservaciones" FieldLabel="Otras observaciones" AnchorHorizontal="100%">
<Listeners>
<Blur Handler="#{txtAnamnesisOrtesis}.hide();" />
</Listeners>
</ext:TextArea>


The document scrolls up to the beginning.

We would like to avoid this, if possible.

Daniil
Jul 12, 2013, 12:43 PM
We would try the same thing that I suggest in the onFieldValidation override, i.e. to maintain a scroll position.

Daniil
May 19, 2014, 4:24 PM
Here is a related thread.
http://forums.ext.net/showthread.php?35211