PDA

View Full Version : [2.0b1][CLOSED] Form field labels don't render in table layout



mschering
24 Oct 2007, 4:06 AM
When you put form fields in a table layout the fieldlabels don't render.

In general I think it should be possible to switch on/off field labels per field and not per fieldset or the whole field.

Example code to see form fields render without their label (Remove the layout:'table' part and they will appear):



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Group-Office Calendar</title>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
<link href="../../resources/css/ext-all.css" type="text/css" rel="stylesheet" />
<script src="../../adapter/ext/ext-base.js" type="text/javascript"></script>
<script src="../../ext-all-debug.js" type="text/javascript"></script>

<script type="text/javascript">
Ext.EventManager.onDocumentReady(function(){
var formPanel= new Ext.form.FormPanel({
renderTo:document.body,
labelWidth: 75, // label settings here cascade unless overridden
defaultType: 'textfield',
layout: 'table',
items:[{
fieldLabel: 'Port',
name: 'port',
allowBlank:false
},{
fieldLabel: 'Test',
name: 'test',
allowBlank:false
}]


});

},this);
</script>
</head>
<body>
</body>
</html>

tryanDLS
24 Oct 2007, 7:49 AM
What is the purpose of setting layout:'table'?

mschering
24 Oct 2007, 8:20 AM
To be more flexible in form layouts. You can have rowspans and colspans.

For example some times I want to have two textfields next to eachother, and on the next row only one that spans the two fields above Think about a street address and a housenumber.

I can think of lots of examples.

jack.slocum
25 Oct 2007, 2:00 AM
This is obviously not a bug. Why report it as one?

If you want a form layout with labels, you have to use a FormLayout.

mschering
25 Oct 2007, 2:14 AM
Because you state in your documentation of the formpanel that this option is valid:
A columnlayout works with labels, but a tablelayout doesn't. If it

mystix
25 Oct 2007, 2:20 AM
[QUOTE=mschering;77872]Because you state in your documentation of the formpanel that this option is valid:
A columnlayout works with labels, but a tablelayout doesn't. If it

mschering
25 Oct 2007, 2:53 AM
Ok so it's expected behaviour that the field labels don't render? And I can use it as a valid layout for forms?

I just don't want to develop something without knowing for sure that it's a valid way of using Ext forms.

liberte
14 Feb 2008, 10:15 AM
Ok so it's expected behaviour that the field labels don't render? And I can use it as a valid layout for forms?

I just don't want to develop something without knowing for sure that it's a valid way of using Ext forms.

I was also surprised by the disappearance of the labels when using table layout. Form field labels also are displayed in fieldset elements, and columns (?), and what else? Why not tables too? Note that I would not expect a field label to show up in the next column to the left. It should just be displayed to the left of the field within the current table cell.

I find the form layout way too limiting on its own, and it just gets in the way except for the simple two-column, label-field layout. In almost every instance, I need something more. The form layout alignment of rows of label-field pairs is really a 2D layout anyway, so why not just use tables, and avoid the hassles of inappropriate use of 'float' style with fixed size labels?

Please at least document these assumptions so people can avoid rediscovering them independentlly. You should assume that there is nothing obvious about this from the perspective of new users.

Least I sound too negative, I still love ExtJS, and I just want to see it improved. ;)

mschering
14 Feb 2008, 11:51 PM
If you add layout: 'form' to a table cell then they will appear!

liberte
15 Feb 2008, 7:32 AM
If you add layout: 'form' to a table cell then they will appear!

Yes, I discovered that too, but you have to add another Container such as a panel or fieldset inside the table cell just to hold even a single form field.

The 'form' layout would be much more useful if it allowed some grouping. The label column is OK, but the thing on the right is often a group of some kind, a row of several fields, or parts that should be conditionally disabled.

I'm not particularly happy with the 'table' layout either, by the way. The list of cells is confusingly flattened (I'd rather have lists of lists, e.g. [[...], [...], ...]), and I haven't found any way to specify attributes for each row, column, or cell. Now I see that the table is built using DOM calls rather than the new XTemplate, which looks like it could be faster and more flexible. I might just have to build my own layout composition mechanism using the parts of ExtJS I like.

phdbrianlee
4 May 2008, 1:16 AM
rendering of fieldlabel does not works for borderlayout too.
Maybe someone argues that this is not a bug.
but I do not think this is a good idea.

why the fieldlabel for textfield only renders in formlayout in a formpanel?

is this a must?

Ext has many aspects that do not works as our expectation.
:s:s:s:s:s:s:s

mschering
4 May 2008, 3:05 AM
You must put a panel with layout: 'form' inside the border layout to contain the fields.