Skip to content

Commit 7e0ea3c

Browse files
committed
Update README.md
1 parent 2410e93 commit 7e0ea3c

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

README.md

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,12 @@ to the require section of your `composer.json` file.
2525

2626
##Usage
2727

28-
In case when input has one column
28+
### Input with one column
2929

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
3134
use unclead\widgets\MultipleInput;
3235

3336
<?= $form->field($model, 'emails')->widget(MultipleInput::className(), [
@@ -36,11 +39,15 @@ use unclead\widgets\MultipleInput;
3639
->label(false);
3740
?>
3841

42+
3943
```
44+
### Input with multiple column in each row
4045

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
4247

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
4451

4552
use unclead\widgets\MultipleInput;
4653
<?= $form->field($model, 'schedule')->widget(MultipleInput::className(), [
@@ -83,33 +90,31 @@ use unclead\widgets\MultipleInput;
8390
]);
8491
```
8592

86-
The configuration of widget is described below
93+
Widget has some configuration options that are described below
8794

8895
## Configuration
8996

9097
Widget support the following options that are additionally recognized over and above the configuration options in the InputWidget:
9198

9299
- `limit`: *integer*: rows limit
93100
- `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**
96103
- `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'; }```
101105
- `defaultValue` *string*: default value of column's input,
102106
- `items` *array*: the items for drop down list if you set column type like as dropDownList
103107
- `options` *array*: the HTML options of column's input
104108

105109
##Examples
106110

107-
Widget supports several use cases:
111+
Look at the example pages for getting more information about use cases
108112

109113
- [Single column example](docs/single_column.md)
110114
- [Multiple columns example](docs/multiple_columns.md)
111115

112-
You cad find source code of examples [here](./examples/)
116+
Also you cad find source code of examples [here](./examples/)
117+
113118
##License
114119

115120
**yii2-multiple-input** is released under the BSD 3-Clause License. See the bundled LICENSE.md for details.

0 commit comments

Comments
 (0)