View Full Version : Left align Checkbox in Form - impossible?
googelybear
24 Aug 2009, 5:36 AM
Hi,
I have a very simple requirement: Align a checkbox in a FormPanel to the LEFT.
The default alignment seems to be centered (which looks weird if there are other fields in the panel).
I looked for setHorizontalAlignment on the panel/field but couldn't find such a thing (or similar).
What's the proper way to do this? Or if there is none then I suggest to add this ;-)
The following screenshot illustrates this problem: http://www.box.net/shared/d9au8tbhi8
Btw. If I put the (single) checkbox in a CheckBoxGroup it is LEFT aligned.
thanks for any help!
Arno.Nyhm
24 Aug 2009, 5:47 AM
in this examples the checkboxes are aligned to the left (classical etc.)
http://extjs.com/examples/explorer.html#forms
maybe the code of your form helps to find out the missing things.
googelybear
24 Aug 2009, 5:50 AM
it is left aligned because it's in a checkboxgroup. But since I'm having only a single checkbox it does not make sense to create a group...
checkBox.setBoxLabel("");
googelybear
24 Aug 2009, 7:41 AM
all right, all right - I'll use a group for my single checkbox ;-) Why don't you want to add a setHorizontalAlignment(...) method? I think it's confusing for new users.
nyklogistics
31 Jan 2010, 5:19 PM
all right, all right - I'll use a group for my single checkbox ;-) Why don't you want to add a setHorizontalAlignment(...) method? I think it's confusing for new users.
i just ran into the same problem, is it possible to align the checkbox (not the CheckBoxGroup) to the left?
mariab
14 Dec 2010, 3:57 AM
Hi,
I have the same problem. Tried to set:
productionCheckBox.setBoxLabel("");
but this resulted in a javascript error: "null" is null or not an object? And I do not understand why that would work to align the checkbox to the left?
Has anyone come up with a solution?
/Maria
Please post a fully working testcase implementing EntryPOint and demonstrates your problem.
mariab
14 Dec 2010, 6:19 AM
This is my onModuleLoad method. I Want the checkbox and the textfield to have their left corners at the same x-postition.
public void onModuleLoad() {
TextField<String> nameFld = new TextField<String>();
nameFld.setFieldLabel("Name");
nameFld.setItemId(ActivityConstants.NAME);
nameFld.setId("nameTextField");
nameFld.setEmptyText("");
nameFld.setAllowBlank(false);
nameFld.setMaxLength(64);
nameFld.setValidateOnBlur(true);
RootPanel.get().add(nameFld);
CheckBox productionCheckBox = new CheckBox();
productionCheckBox.setFieldLabel("Production");
productionCheckBox.setName("Production");
productionCheckBox.setValue(true);
productionCheckBox.setItemId("Production");
productionCheckBox.setId("productionCheckBox");
RootPanel.get().add(productionCheckBox);
}
Where does this code show the exception you referenced earlier? That testcase does not even contain a call to setBoxLabel
Also adding that call does not throw an exception for me in IE or FF against GXT 2.2.1
mariab
15 Dec 2010, 5:14 AM
Hi,
My mistake..now its working like it should with
setBoxLabel("");
Thank You, again :)
Great, thanks for the update.
Powered by vBulletin® Version 4.1.5 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.