[CLOSED] [2.1] ValidationStatus plugin scrolling the document up.

  1. #1

    [CLOSED] [2.1] ValidationStatus plugin scrolling the document up.

    Last edited by Daniil; Jul 16, 2013 at 4:30 AM. Reason: [CLOSED]
  2. #2
    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);
        }
    });
  3. #3
    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);
  4. #4
    OK, replaced it with

    formPanelBody.scrollTo('top', scroll.top);
    formPanelBody.scrollTo('side', scroll.left);
    and it worked. Thank you!
  5. #5
    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);
  6. #6
    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.
  7. #7
    We would try the same thing that I suggest in the onFieldValidation override, i.e. to maintain a scroll position.
  8. #8
    Here is a related thread.
    http://forums.ext.net/showthread.php?35211

Similar Threads

  1. [CLOSED] [1.0] ValidationStatus plugin icons broken
    By tdracz in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: May 07, 2010, 8:25 PM
  2. [CLOSED] [1.0] MultiField with ValidationStatus
    By danielg in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Feb 20, 2010, 12:33 PM
  3. [CLOSED] ValidationStatus Plugin in code-behind
    By randy85253 in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Feb 14, 2010, 10:10 AM
  4. [CLOSED] icon-accept and ValidationStatus
    By idrissb in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Sep 26, 2009, 2:15 PM

Tags for this Thread

Posting Permissions