I am rendering a view through renderAjax and it has a TouchSpin widget (kartik-v) but the widget is not displaying properly, I believe it has something to do with the initialization of the widget but I believe this should work because I’m using renderAjax not renderPartial. Kindly help me, thanks.
Here is my code:
Controller:
use yii\helpers\Url;
use yii\helpers\Html;
use kartik\touchspin\TouchSpin;
$hashids = Yii::createObject(['class' => 'light\hashids\Hashids']);
$product = Products::findOne($hashids->decode($id));
return $this->renderAjax("product-details-modal", [
'product' => $product
]);
View:
use yii\helpers\Url;
use yii\helpers\Html;
use kartik\touchspin\TouchSpin;
$hashids = Yii::createObject(['class' => 'light\hashids\Hashids']);
echo TouchSpin::widget([
"name" => "product-modal-quantity",
'pluginOptions' => ['verticalbuttons' => true]
]);