[CLOSED] Adding controls to VBox layout causes scrolling to top

  1. #1

    [CLOSED] Adding controls to VBox layout causes scrolling to top

    Hi,

    i am experiencing a reset of the scroll position when both adding or removing controls to a scrollable panel having VBox layout. Is there a possibility to maintain the scroll position?

    <!DOCTYPE html>
    <html>
    <head>    
        <meta charset="utf-8" />
    </head>
    <body>
    
        @Html.X().ResourceManager()    
    
        @(Html.X().FormPanel()
            .ID("MyFormPanel")
            .Title("Panel Title")
            .AutoScroll(true)
            .MaxHeight(200)            
            .Layout(LayoutType.VBox)
            .Items(        
                it =>
                {
                    it.Add(Html.X().TextArea().Height(400));
                    it.Add(Html.X().Button().ID("TestButton").Text("Remove Me").OnClientClick("App.TestButton.destroy();"));                
                    it.Add(Html.X().Button().Text("Add").OnClientClick("Ext.getCmp('MyFormPanel').add({width:50,xtype:'textfield'});"));
                })
         )
            
    </body>
    </html>
    Greetings and thank you,
    extnetuser
    Last edited by Baidaly; May 16, 2013 at 1:14 AM. Reason: [CLOSED]
  2. #2
    Hi @extnetuser,

    Thank you for a clear example.

    This appears to be working for adding.
    var panel = App.MyFormPanel,
        scrollTopToRestore = panel.body.getScrollTop(); 
    
    panel.add({ xtype: 'textfield' });
    panel.body.setScrollTop(scrollTopToRestore);
    I think it should work for removing as well.
  3. #3
    Thank you kind Sir, you workaround works.

    Thread can be marked as closed.

Similar Threads

  1. [CLOSED] Layout VBox in complicated collapsed?
    By ViDom in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Nov 24, 2012, 12:54 AM
  2. vbox layout is not working on image button
    By robertgan in forum 1.x Help
    Replies: 1
    Last Post: Feb 27, 2012, 9:17 AM
  3. Replies: 2
    Last Post: Feb 21, 2012, 8:05 AM
  4. [CLOSED] vbox layout inside column layout
    By craig2005 in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Feb 04, 2011, 2:44 PM
  5. [CLOSED] [1.0] Issue with VBox Layout in Latest SVN
    By Hari_CSC in forum 1.x Legacy Premium Help
    Replies: 7
    Last Post: Jul 07, 2010, 5:07 PM

Tags for this Thread

Posting Permissions