itpg
(Aigars Muiznieks)
November 1, 2014, 2:08pm
1
I can’t get DatePicker to work.
Code in view:
.......
<?= $form->field($model, 'name')->widget( yii\jui\DatePicker::className(),['clientOptions' => ['dateFormat' => 'yy-mm-dd', 'defaultDate' => '2014-01-01']]) ?>
.........
I get error:
Class ‘yii\jui\DatePicker’ not found
Tried also:
widget( \yii\jui\DatePicker::className()
widget( DatePicker::className()
Result is the same.
Class DatePicker is located at vendor/yiisoft/yii2-jui/DatePicker.php
Where could be the problem?
pkjoshi
(Info)
November 2, 2014, 8:14pm
2
itpg:
I can’t get DatePicker to work.
Code in view:
.......
<?= $form->field($model, 'name')->widget( yii\jui\DatePicker::className(),['clientOptions' => ['dateFormat' => 'yy-mm-dd', 'defaultDate' => '2014-01-01']]) ?>
.........
I get error:
Class ‘yii\jui\DatePicker’ not found
Tried also:
widget( \yii\jui\DatePicker::className()
widget( DatePicker::className()
Result is the same.
Class DatePicker is located at vendor/yiisoft/yii2-jui/DatePicker.php
Where could be the problem?
Have you added on top of the file
use yii\jui\DatePicker;
evstevemd
(Stefano Mtangoo)
November 2, 2014, 9:15pm
3
yii\jui\DatePicker::className()
in your code should be
\yii\jui\DatePicker::className()
itpg
(Aigars Muiznieks)
November 3, 2014, 4:28am
4
yes, but it gives the same result
itpg
(Aigars Muiznieks)
November 3, 2014, 4:29am
5
changed but it gives the same result
remram
(Mster)
November 3, 2014, 3:23pm
7
Did you install JUI Extension for Yii 2 ?
How to install: https://github.com/yiisoft/yii2-jui#installation
itpg
(Aigars Muiznieks)
November 3, 2014, 5:51pm
8
no, but I have already these files https://github.com/yiisoft/yii2-jui under /vendor/yiisoft/yii2-jui/
evercode
(Ikon321)
November 3, 2014, 9:11pm
9
Is it possible you have a namespace problem? Make sure you have:
namespace yii\jui;
at the top of your DatePicker.php file.
samdark
(Alexander Makarov)
November 5, 2014, 9:25am
11
How did you get /vendor/yiisoft/yii2-jui/? If you’ve just copied it it won’t work. You have to install it via Composer.
remram
(Mster)
November 5, 2014, 9:28am
12
No? how did you install it? you can’t put the files by yourself! if you did that you need to modify the extension.php file. So i recommend you to install the extension by composer!!!
evercode
(Ikon321)
November 5, 2014, 9:29pm
13
As Xview is saying, you should confirm that you have in extensions.php:
'yiisoft/yii2-jui' =>
array (
'name' => 'yiisoft/yii2-jui',
'version' => '2.0.0.0',
'alias' =>
array (
'@yii/jui' => $vendorDir . '/yiisoft/yii2-jui',
),
),
Otherwise it will not work. When you install an extension via composer, extensions.php is automatically updated for you, which is a lot easier in the long run than trying to keep track of it manually.