README.md 1.17 KB
Newer Older
1 2
JUI Extension for Yii 2
=======================
3

4
This is the JQuery UI extension for Yii 2. It encapsulates [JQuery UI widgets](http://jqueryui.com/) as Yii widgets,
5
and makes using JQuery UI widgets in Yii applications extremely easy. For example, the following
6
single line of code in a view file would render a [JQuery UI DatePicker](http://api.jqueryui.com/datepicker/) widget:
7

8
```php
9 10 11 12
<?= yii\jui\DatePicker::widget(['name' => 'attributeName']) ?>
```

Configuring the Jquery UI options should be done using the clientOptions attribute:
13

14
```php
15
<?= yii\jui\DatePicker::widget(['name' => 'attributeName', 'clientOptions' => ['defaultDate' => '2014-01-01']]) ?>
16 17
```

18 19
If you want to use the JUI widget in an ActiveForm, it can be done like this:

20
```php
21
<?= $form->field($model,'attributeName')->widget(DatePicker::className(),['clientOptions' => ['defaultDate' => '2014-01-01']]) ?>
22
```
23

24

25
Installation
26 27
------------

28
The preferred way to install this extension is through [composer](http://getcomposer.org/download/).
29 30

Either run
31

32
```
33
php composer.phar require --prefer-dist yiisoft/yii2-jui "*"
34 35 36
```

or add
37

38 39 40 41
```
"yiisoft/yii2-jui": "*"
```

42
to the require section of your `composer.json` file.