@@ -25,9 +25,12 @@ to the require section of your `composer.json` file.
25
25
26
26
##Usage
27
27
28
- In case when input has one column
28
+ ### Input with one column
29
29
30
- ```
30
+ For example you want to have an ability of entering several emails of user on profile page.
31
+ In this case you can use yii2-multiple-input widget like in the following code
32
+
33
+ ``` php
31
34
use unclead\widgets\MultipleInput;
32
35
33
36
<?= $form->field($model, 'emails')->widget(MultipleInput::className(), [
@@ -36,11 +39,15 @@ use unclead\widgets\MultipleInput;
36
39
->label(false);
37
40
?>
38
41
42
+
39
43
```
44
+ ### Input with multiple column in each row
40
45
41
- In case when input has multiple columns
46
+ For example you keep some data in json format in attribute of model. Imagine that it is an absctract user schedule with keys: user_id, day, priority
42
47
43
- ```
48
+ On the edit page you want to be able to manage this schedule and you can you yii2-multiple-input widget like in the following code
49
+
50
+ ``` php
44
51
45
52
use unclead\widgets\MultipleInput;
46
53
<?= $form->field($model, 'schedule')->widget(MultipleInput::className(), [
@@ -83,33 +90,31 @@ use unclead\widgets\MultipleInput;
83
90
]);
84
91
```
85
92
86
- The configuration of widget is described below
93
+ Widget has some configuration options that are described below
87
94
88
95
## Configuration
89
96
90
97
Widget support the following options that are additionally recognized over and above the configuration options in the InputWidget:
91
98
92
99
- ` limit ` : * integer* : rows limit
93
100
- ` columns ` * array* : the row columns configuration where you can set the following properties:
94
- - ` name ` * string* : input name. Required options
95
- - ` type ` * string* : type of the input. If not set will default to ` textInput `
101
+ - ` name ` * string* : input name. * Required options*
102
+ - ` type ` * string* : type of the input. If not set will default to ` textInput ` ** TBD **
96
103
- ` title ` * string* : the column title
97
- - ` value ` * Closure* : you can set it to an anonymous function with the following signature:
98
- ```
99
- function($data) { return 'something'; }
100
- ```
104
+ - ` value ` * Closure* : you can set it to an anonymous function with the following signature: ``` function($data) { return'something'; } ```
101
105
- ` defaultValue ` * string* : default value of column's input,
102
106
- ` items ` * array* : the items for drop down list if you set column type like as dropDownList
103
107
- ` options ` * array* : the HTML options of column's input
104
108
105
109
##Examples
106
110
107
- Widget supports several use cases:
111
+ Look at the example pages for getting more information about use cases
108
112
109
113
- [ Single column example] ( docs/single_column.md )
110
114
- [ Multiple columns example] ( docs/multiple_columns.md )
111
115
112
- You cad find source code of examples [ here] ( ./examples/ )
116
+ Also you cad find source code of examples [ here] ( ./examples/ )
117
+
113
118
##License
114
119
115
120
** yii2-multiple-input** is released under the BSD 3-Clause License. See the bundled LICENSE.md for details.
0 commit comments