source: Dev/trunk/src/client/dojox/mobile/FormLayout.js @ 529

Last change on this file since 529 was 483, checked in by hendrikvanantwerpen, 11 years ago

Added Dojo 1.9.3 release.

File size: 3.4 KB
Line 
1define([
2        "dojo/_base/declare",
3        "dojo/dom-class",
4        "./Container"
5], function(declare, domClass, Container){
6
7        // module:
8        //              dojox/mobile/FormLayout
9
10        return declare("dojox.mobile.FormLayout", Container, {
11                // summary:
12                //              A responsive container to create mobile forms.
13                // description:
14                //              This container layouts form widgets according to the screen size.
15                //              Each row of a form is made of a <label> and a <fieldset> that contains one or more form widgets.
16                //              By default, if the width of the screen if greater than 500px, the <label> and the <fieldset> are positioned on the same line.
17                //              Otherwise they are stacked vertically. You can force how a <label> and its <fieldset> are positioned using the
18                //              'columns' property.
19                //              Form controls are: "dojox/mobile/Button", "dojox/mobile/CheckBox", "dojox/mobile/ComboBox",
20                //              "dojox/mobile/RadioButton", "dojox/mobile/Slider", "dojox/mobile/TextBox", "dojox/mobile/SearchBox",
21                //              "dojox/mobile/ExpandingTextArea", "dojox/mobile/ToggleButton".
22                // example:
23                // |    <div data-dojo-type="dojox/mobile/FormLayout" data-dojo-props="columns:'two', rightAlign:true">
24                // |            <div>
25                // |                    <label>Name:</label>
26                // |                    <fieldset>
27                // |                            <input data-dojo-type="dojox/mobile/TextBox">
28                // |                    </fieldset>
29                // |            </div>
30                // |            <div>
31                // |                    <label>Make a choice:</label>
32                // |                    <fieldset>
33                // |                            <input type="radio" id="rb1" data-dojo-type="dojox/mobile/RadioButton" name="mobileRadio" checked><label for="rb1">Small</label>
34                // |                            <input type="radio" id="rb2" data-dojo-type="dojox/mobile/RadioButton" name="mobileRadio" checked><label for="rb2">Medium</label>
35                // |                            <input type="radio" id="rb3" data-dojo-type="dojox/mobile/RadioButton" name="mobileRadio" checked><label for="rb3">Large</label>
36                // |                    </fieldset>
37                // |            </div>
38                // |    </div>
39
40
41                // columns: [const] "auto" | "single" | "two"
42                //              This property controls how a <label> and its <fieldset> are positioned. The <label> can be on the same line
43                //              than its <fieldset> (two columns) or on top of it (single column).
44                //              If set to "auto", the number of columns depends on the width of the screen: Two columns
45                //              if the width of the screen is larger than 500px, one column otherwise. The width of the screen is determined using CSS
46                //              Media Queries.
47                //              Setting this property to "single" or "two" allows to force the layout used whatever the width of the screen.
48                //              Default value for this property is "auto".
49                //              Note that changing the value of the property after the widget
50                //              creation has no effect.
51                columns: "auto",
52
53                // rightAlign: [const] Boolean
54                //              This property controls the horizontal position of control(s) in a <fieldset>. It applies only
55                //              to forms that have two columns (see 'columns' property).
56                //              Default value for this property is false.
57                //              Note that changing the value of the property after the widget
58                //              creation has no effect.
59                rightAlign: false,
60
61                /* internal properties */
62
63                // baseClass: String
64                //              The name of the CSS class of this widget.
65                baseClass: "mblFormLayout",
66
67                buildRendering: function(){
68                        this.inherited(arguments);
69                        if(this.columns == "auto"){
70                                domClass.add(this.domNode, "mblFormLayoutAuto");
71                        }else if(this.columns == "single"){
72                                domClass.add(this.domNode, "mblFormLayoutSingleCol");
73                        }else if(this.columns == "two"){
74                                domClass.add(this.domNode, "mblFormLayoutTwoCol");
75                        }
76                        if(this.rightAlign){
77                                domClass.add(this.domNode, "mblFormLayoutRightAlign");
78                        }
79                }
80        });
81});
Note: See TracBrowser for help on using the repository browser.