-
3 Jun 2010 4:06 AM #1
ExtJs.Form.Label (text-Alignment) not working
ExtJs.Form.Label (text-Alignment) not working
Hi all,
I am not able to align Label text to the right.
(In HTML style we have text-align).Like this in Ext Js which property i have to add?...
I have tried LabelStyle it is not working.And also tried with CSS it is also not working.
Please review my code and help me.
<style>
.test-lbl-text-align
{font-weight:bold;color:red;text-align:right;}
</style>
Ext.onReady(function()
{
var <%=this.ID%> = new Ext.form.Label(
{
cls: 'test-lbl-text-align',
text: 'test',
labelStyle: 'text-align:right;border
olid 1px black;',
width:'200',
height:'200',
renderTo: document.body
});
});
Thanks in advance.
Regards,
Arul Prakash.M
-
3 Jun 2010 5:57 AM #2Sencha - Desktop Packager Dev Team
- Join Date
- Mar 2007
- Location
- Baltimore, MD.
- Posts
- 1,745
- Vote Rating
- 6
A label by default is an inline element, and thus giving it a specific width/height isn't going to have an effect. You can set its display to 'block', and then it should work for you:
Code:<style> .test-lbl-text-align {font-weight:bold;color:red;text-align:right;display:block;width:200px;height:200px;} </style> Ext.onReady(function(){ var <%=this.ID%> = new Ext.form.Label({ cls: 'test-lbl-text-align', text: 'test', renderTo: document.body }); });
-
3 Jun 2010 6:39 AM #3
Thanks you very much nicolls.
Your code working fine for me.
With out using CssClass is there any way to acheive text-align?.......
Thanks in advance.
Regards,
Arul Prakash.M
-
3 Jun 2010 7:40 AM #4Sencha - Desktop Packager Dev Team
- Join Date
- Mar 2007
- Location
- Baltimore, MD.
- Posts
- 1,745
- Vote Rating
- 6
Sure, you can apply the CSS directly to the label by using the "style" configuration option:
Code:Ext.onReady(function(){ var <%=this.ID%> = new Ext.form.Label({ style: 'font-weight:bold;color:red;text-align:right;display:block;width:200px;height:200px;', text: 'test', renderTo: document.body }); });
-
3 Jun 2010 7:57 AM #5
Thank u so much nicholls...for your quick reply.
It is working fine.
Thanks & Regards,
Arul Prakash.M
-
14 May 2012 9:29 PM #6
I have a simpler method. Whenever I add in the label I do the following :--
label : '<p style="text-align: center;">My Label</p>'
replace the word center with right, left, etc
Similar Threads
-
Two text fields with label in form panel in column layout?
By philipp_sidarion in forum Ext 3.x: Help & DiscussionReplies: 1Last Post: 11 May 2010, 8:30 AM -
Form fieldlabel : button (or component) instead of text as field label
By mailme_gx in forum Ext 3.x: Help & DiscussionReplies: 4Last Post: 14 Sep 2009, 11:20 PM -
Add a image and text in ext.form.label
By Selvam packiam in forum Ext 2.x: Help & DiscussionReplies: 0Last Post: 1 Jan 2009, 11:19 PM -
extjs combo in regular form - alignment issue
By bai in forum Ext 1.x: Help & DiscussionReplies: 1Last Post: 30 Mar 2008, 11:27 PM -
How to add simple text label onto form
By olperv in forum Ext 1.x: Help & DiscussionReplies: 2Last Post: 12 Jul 2007, 3:46 AM


Reply With Quote