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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T06:22:17+00:00 2026-06-13T06:22:17+00:00

I have two questions regarding component layout using Sencha Touch 2: How can you

  • 0

I have two questions regarding component layout using Sencha Touch 2:

  • How can you right align text in a container?
  • How can you concatenate different bits of dynamic data intermixed with static data into a component that needs to line wrap?

I have a view that I want to render like this:

Desired view layout

Where the “Seen:” text is static and right aligned, and the text on the right is a concatenated string with 3 dynamic pieces of text and two pieces of static text.

I have something that works, but it doesn’t feel right.

xtype:'container',
    layout:{
    type:'hbox'
},
items:[
    {
        xtype:'container',
        flex:1,
        layout:{
            type:'hbox'
        },
        items:[
            {
                xtype:'spacer',
                layout:'fill'
            },
            {
                xtype:'label',
                layout:'fit',
                html:'Seen:'
            }
        ]
    },
    {
        xtype:'label',
        name:'contentLabel',
        flex:5,
        html:'[BUILD A STRING AND SET THE HTML HERE]'
    }
]

Right-aligning

So to right-align the text, I basically used an hbox container with a spacer component on the left and a label on the right. There’s got to be an easier way.

Concatenating

I am able to build the string that I want to place on the right, but I’d rather have multiple labels that I can map one-to-one with my model. It doesn’t feel like MVC for me to have to write code to concatenate strings.

I tried breaking apart the right side into an hbox, but there were problems with line wrapping. Each label wants to render itself individually, so if there were wrapping, it would happen within its own container.

Are there easier ways of doing what I am attempting?

  • 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-06-13T06:22:18+00:00Added an answer on June 13, 2026 at 6:22 am

    Right aligning: it can be done with the text-align CSS property. In the example below I use the style property for simplicity, but using the cls property would be more flexible – it adds a CSS class to the component, so you can style it in the .sass file.

    Concatenating: you can use the standard join() Javascript function. It concatenates all elements of an array into a string using the given separator. In my example dynamic1 and dynamic2 are variables.

    So the result code:

    xtype: 'container',
    layout: {
        type: 'hbox'
    },
    items: [
        {
            xtype: 'label',
            flex: 1,
            html: 'Seen:',
            style: 'text-align:right'
        },
        {
            xtype: 'container',
            flex: 5,
            html: ['static1', 'static2', dynamic1, 'static3', dynamic2].join('')
        }
    ]
    

    EDIT

    You can also use the tpl property to define a template that renders data property. You can update it programatically calling container.setData()

    xtype: 'container',
    layout: {
        type: 'hbox'
    },
    items: [
        {
            xtype: 'label',
            flex: 1,
            html: 'Seen:',
            style: 'text-align:right'
        },
        {
            xtype: 'container',
            flex: 5,
            data: {
                name: 'Harry Potter',
                day: 'Saturday',
                date: 'October 21, 2011'
            },
            tpl: [
                '{name} on {day} {date}'
            ]
        }
    ]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two questions regarding an NSArray: How can I add nil values to
I have two questions regarding to html table layout. First I will provide some
I have two questions regarding jsTree: I am generating a jsTree using JSON with
I have two questions regarding a login form I'm styling. I am using onfocus
I have two questions regarding the multidimensional arrays. I declared a 3D array using
I have two questions regarding the '::' case class. :: can be used as
I have two questions regarding to the positioning of a mpl window (using WXAgg
I actually have two questions regarding exception/error handling in the iPhone app that I
I have two questions here. How can I show the header of the pop
I have two questions. How can I get the spinner in the figure below

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.