Results 1 to 5 of 5

Thread: Strange behavior in HLC within TabPanel

  1. #1
    Sencha User
    Join Date
    May 2011
    Posts
    51
    Answers
    2

    Default Strange behavior in HLC within TabPanel

    I could really use some help! I'm having an issue with HorizontalLayoutContainer's losing their children's position when moving from tab to tab in a TabPanel. First let me show you what happens with a couple images and then let me explain what I'm trying to accomplish. Notice the button in these images.


    GOOD: (FIRST VISIT)

    hlcworking.png

    BAD : (SECOND VISIT)
    hlcbad.png

    In this case, I want a button to the right of a text field in my form. On the first visit to the tab it looks exactly how it should. But switch to another tab and then back and the button now appears on the left side of the horizontal container.

    In the generated HTML in both instances I can see that the button is set to position absolute but the first time you visit the left is 228 and every other time you revisit the page it sets left to 0.

    Here is an example of how I build it:

    Code:
    advertiserBox = new TextField();
    advertiserBox.setWidth(225);
    
    advertiserBtn = new TextButton();
    advertiserBtn.setIcon(ResourcesBundle.INSTANCE.organization());
    advertiserBtn.setHeight(22);
    
    HorizontalLayoutContainer advertiserContainer = new HorizontalLayoutContainer();
    advertiserContainer.add(advertiserBox);
    advertiserContainer.add(advertiserBtn);
    
    formContainer = new VerticalLayoutContainer();
    formContainer .add(new FieldLabel(advertiserContainer, "Advertiser"), new VerticalLayoutData(-1, -1, Margins(0, 0, 5, 0)));
    
    Then the form container is added to the content panel.

  2. #2
    Sencha User
    Join Date
    Jul 2011
    Location
    Germany
    Posts
    223
    Answers
    5

    Default

    Please state GWT version, GXT version, Browser, Dev Mode/Prod Mode, etc.

  3. #3
    Sencha User
    Join Date
    May 2011
    Posts
    51
    Answers
    2

    Default

    GWT 2.6.1, GXT 3.1.1, happens in all major browsers and all modes.

  4. #4
    Ext GWT Premium Member
    Join Date
    Aug 2010
    Location
    Germany, Solingen
    Posts
    281
    Answers
    4

    Default

    Have you tried to call forceLayout() after you select a new tab?

  5. #5
    Sencha Sr Product Manager
    Join Date
    Jan 2012
    Location
    Arlington, WA
    Posts
    1,167
    Answers
    12

    Default

    Force layout probably won't work b/c the HLC adds the children without layout data. I'd suggest adding HLC layoutdata and use that to size the children. In this way the sizing will be done when the tab is selected. And that is assuming if the parents and grandparent containers pass down the sizing too.

    Code:
    HorizontalLayoutContainer advertiserContainer = new HorizontalLayoutContainer();
    advertiserContainer.add(advertiserBox, /* layout data to size child */);
    advertiserContainer.add(advertiserBtn, /* layout data to size child */);

Similar Threads

  1. Strange behavior or bug
    By Donbydon in forum Sencha Touch 2.x: Q&A
    Replies: 1
    Last Post: 28 Feb 2012, 3:39 PM
  2. Gridpanel : Strange behavior in IE vs good behavior with Firefox
    By Jayeff_land in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 13 Oct 2009, 5:31 AM
  3. Strange behavior
    By eertl in forum Ext 2.x: Help & Discussion
    Replies: 6
    Last Post: 23 Jan 2009, 9:02 AM
  4. Strange behavior
    By Boon in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 4 Jan 2009, 5:17 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
  •