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

How to write a getter that can not be deleted? I want to own
I was trying to write my own little algorithm for graph layout that only
i want to write my own photogallery like the original Photos.app from apple. I´ve
I want to write my own algorithm (just a function really) that takes a
I want to write my own simple DI framework. I want that it perform
Hello I want write my own desktop sharing application in Java. The application should
I want to write a browser-chat and write an own server in c++, because
I am new to the play framework and want to write my own twitter
I have created blank Asp.Net-MVC 3 web application and want to write my own
I want write a simple query which will fetch data from a table (which

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.