Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6931561
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:35:38+00:00 2026-05-27T11:35:38+00:00

Using Ext JS 4.0.2, I’m trying to open a window that automatically sizes itself

  • 0

Using Ext JS 4.0.2, I’m trying to open a window that automatically sizes itself big enough to fit its content, until it hits a height limit, at which point it stops getting bigger and shows a scroll bar.

Here’s what I’m doing

Ext.create('widget.window', {
    maxHeight: 300,
    width: 250,
    html: someReallyBigContent,
    autoScroll: true,
    autoShow: true
});

When the window is first rendered, it’s sized big enough for the really big content–bigger than the maxHeight should allow. If I attempt to resize it, then snaps down to the maxHeight of 300px.

How do I constrain the window to its maxHeight when it’s initially rendered?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T11:35:39+00:00Added an answer on May 27, 2026 at 11:35 am

    I have exactly the same problem and for now I’m doing a litle dirty hack 🙂

    this.on('afterrender', function() {
        if (this.getHeight() > this.maxHeight) {
            this.setHeight(this.maxHeight);
        }
        this.center();
    }, this);
    

    Depending on the content of the window, you must use the afterlayout event. Instead of using this.maxHeight, to use the whole viewport, use Ext.getBody().getViewSize().height or in vanilla JS use window.innerHeight.

    This version will work even if the windows contains other components and not only huge html:

    listeners: {afterlayout: function() {
        var height = Ext.getBody().getViewSize().height;
        if (this.getHeight() > height) {
            this.setHeight(height);
        }
        this.center();
    }}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using ext/ldap I'm trying to add entries to an Active Directory. As long as
I'm using Ext.util.json.encode to encode the column model from a jqgrid, and passing that
I'm getting inconstant results using Ext.getCmp on my htmlEditor. I'm noticing that it is
I'm building a search using ext-js. I have an event that fires on keyup.
I am new to ExtJs(using EXT js 4 ), I am trying out simple
I am using GWT 1.6.4 and GWT-Ext 2.0.6. I am trying to use EditorGridPanel
I'm thinking of using Ext.Window for my project. I was wondering whether it is
I am currently trying to create the following database schema with SQLAlchemy (using ext.declarative):
ANSWER: The problem is that I am trying to make a cross-domain call using
We are using Ext JS for an application in work, building a custom theme

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.