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 4068516
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T16:23:05+00:00 2026-05-20T16:23:05+00:00

I want to write my own layout.. (like vbox , border and so one)…

  • 0

I want to write my own layout.. (like vbox, border and so one)… What i want to do is to create layout that will place it’s content in the middle (verticall – middle, horisontal – middle)..

Is there some one who could show me how this control will look like in extJs or can provide some links that may be usefull?


I have this example from

http://dev.sencha.com/deploy/dev/examples/layout-browser/layout-browser.html

Ext.ux.layout.CenterLayout = Ext.extend(Ext.layout.FitLayout, {
// private
setItemSize : function(item, size){
    this.container.addClass('ux-layout-center');
    item.addClass('ux-layout-center-item');
    if(item && size.height > 0){
        if(item.width){
            size.width = item.width;
        }
        item.setSize(size);
    }
}
});

Ext.Container.LAYOUTS['ux.center'] = Ext.ux.layout.CenterLayout;

But it gives me more questions than answers.. What is setItemSize How it works? When? Why? ect. What is item.setSize called for? How it works? When? Why? ect.

  • 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-20T16:23:06+00:00Added an answer on May 20, 2026 at 4:23 pm

    check the examples of ExtJS 3, there is an Ext.ux.Layout.CenterLayout under custom layouts there already, maybe a good point to start?

    http://dev.sencha.com/deploy/dev/examples/layout-browser/layout-browser.html


    Edit: Try this layout user extension, it centers an item in the horizontal and vertical center of it’s container

    Ext.ns('Ext.ux.layout');
    
    Ext.ux.layout.CenterLayout = Ext.extend(Ext.layout.ContainerLayout, {
        monitorResize:true,
        type: 'ux.center',
        getLayoutTargetSize : function() {
            var target = this.container.getLayoutTarget();
            if (!target) {
                return {};
            }
            return target.getStyleSize();
        },
        onLayout : function(ct, target){
            Ext.ux.layout.CenterLayout.superclass.onLayout.call(this, ct, target);
            if(!ct.collapsed){
                this.setItemSize(this.activeItem || ct.items.itemAt(0), this.getLayoutTargetSize());
            }
        },
        setItemSize : function(item, size){
            var left = (size.width - item.getWidth()) / 2;
            var top  = (size.height - item.getHeight()) / 2;
    
            var pos = Ext.apply(item.getEl().getPositioning(), {
                position : 'absolute',
                left     : left,
                top      : top
            });
            item.getEl().setPositioning(pos);
        }
    });
    Ext.Container.LAYOUTS['ux.center'] = Ext.ux.layout.CenterLayout;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to write some JavaScript that will change the onmousedown of a div
i want to write my own photogallery like the original Photos.app from apple. I´ve
I want to write some jquery that will extend $.browser with some of my
I want to use Powershell to write some utilities, leveraging our own .NET components
I want to write a command that specifies the word under the cursor in
I want to write a function in Python that returns different fixed values based
I want to write a function that takes an array of letters as an
I want to write a word addin that does some computations and updates some
I would like to write my own (toy?) web framework as a learning experience.
I want to use a temp directory that will be unique to this build.

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.