didierM
(Didier)
1
I try to insert a Spinner in a Yii 2.0 view with yii/jui/Spinner, downloaded from Github.
In the view I’ve inserted the following command :
[i]use yii\jui\Spinner;
echo Spinner::widget(array(
'name' => 'country',
'clientOptions' => array(
'step' => 2,
),
));
[/i]
but I’ve got the error message: Cannot redeclare class yii\jui\DatePicker.
Can someone give me an advice?
CeBe
2
Can you please give the full error message with file and line of code + stack trace?
didierM
(Didier)
3
The full message error is:
Compile Error – yii\base\ErrorException
Cannot redeclare class yii\jui\DatePicker
- in /Applications/MAMP/htdocs/yii2/advanced/vendor/yiisoft/yii2/yii/jui/datepicker.php at line 99
94 $contents[] = Html::tag(‘div’, null, $this->options);
95 }
96
97 return implode("\n", $contents);
98 }
99 }
- yii\base\Application::handleFatalError()
CeBe
4
How did a file named "datepicker.php" come to the the jui directory there? The file in lower case name is not part of the yii code…
Also the directory structure does not look like you are using the latest code. Please upated at least to the alpha version of yii2 and try again.
didierM
(Didier)
5
Thank you for spending time for my question.
It’s true “DatePicker.php” is not part of the yii code.
I installed the alpha version of yii2 and I didn’t find how insert a Spinner in a view.
From GitHub, I installed the development made by Alexander Kochetov: a jQuery UI spinner widget (github.com/yiisoft/yii2/blob/becc88e4b6602d4bc59daa98534466f48c54c9bb/framework/yii/jui/Spinner.php)
.
Perhaps, it’s not a good idea.
But how insert a spinner widget with the pure alpha version of yii2?
didierM
(Didier)
6
I solved my problem.
JUI extension was improperly installed.
Proper installation procedure is describe here: https://github.com/yiisoft/yii2-jui