Results 1 to 4 of 4

Thread: Form layout: fields w/ 100% width and autoScroll: true

  1. #1
    Sencha User
    Join Date
    Feb 2009
    Location
    Germany, Nuremberg
    Posts
    39

    Question Form layout: fields w/ 100% width and autoScroll: true

    I've got a form with several fields. I'd like to stretch them horizontally. I set default options to layout:
    Code:
    defaults: {
      anchor: '100%'
    }
    it works, but when we have vertical scrolling there is a horizontal one too (see screenshot_1). If i set anchor: '-20' ( reserved space for scrolling), we have 20px white space when page has no vertical scrolling (see screenshot_2).

    How to config layout that will stretch field as expected - with no space and no horizontal scrolling?
    Attached Images Attached Images

  2. #2
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,245

    Default

    The browser doesn't trigger an event when a scrollbar becomes visible, so Ext doesn't have a way to adjust for the scrollbar.

    The only thing you could do is render the fields with anchor:'0' and when all fields are rendered, check if a scrollbar is visible. If it is visible you adjust all anchors to '-20' and relayout.

    ps. I don't like the solution and just use '-20' everywhere.

  3. #3
    Sencha User
    Join Date
    Feb 2009
    Location
    Germany, Nuremberg
    Posts
    39

    Default

    Quote Originally Posted by Condor View Post
    The browser doesn't trigger an event when a scrollbar becomes visible, so Ext doesn't have a way to adjust for the scrollbar.
    you are right. But if we want to make div tag stretch 100% we set 'width: 100%' in css and dont need any javascript events)) so, why formpanel cant work on the same principal?

  4. #4
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,245

    Default

    That works for a single element, but form fields are made up of several elements that won't follow the width:'100%' of the wrap.

Similar Threads

  1. Layout problem - can't set height/width to 100%
    By Torquester in forum Ext GWT: Discussion
    Replies: 2
    Last Post: 3 Aug 2009, 2:13 AM
  2. How to make form fields 100% width?
    By mpaciga in forum Ext GWT: Help & Discussion (1.x)
    Replies: 4
    Last Post: 4 Feb 2009, 2:41 PM
  3. Layout stretches width to 100%. How do you prevent it?
    By Payam in forum Ext GWT: Help & Discussion (1.x)
    Replies: 0
    Last Post: 1 Jul 2008, 7:00 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •