/** * Register script. * */ protected function registerClientScript() { $view = $this->context->getView(); MultipleInputAsset::register($view); $jsBefore = $this->collectJsTemplates(); $template = $this->prepareTemplate(); $jsTemplates = $this->collectJsTemplates($jsBefore); $options = Json::encode(['id' => $this->id, 'template' => $template, 'jsTemplates' => $jsTemplates, 'limit' => $this->limit, 'attributeOptions' => $this->attributeOptions]); $js = "jQuery('#{$this->id}').multipleInput({$options});"; $view->registerJs($js); }
/** * Register script. */ public function registerClientScript() { $view = $this->getView(); MultipleInputAsset::register($view); $options = Json::encode(['id' => $this->getId(), 'template' => $this->renderRowContent(), 'jsTemplates' => $this->jsTemplates, 'btnAction' => self::ACTION_REMOVE, 'btnType' => 'btn-danger', 'limit' => $this->limit, 'replacement' => $this->replacementKeys, 'attributeOptions' => $this->attributeOptions]); $id = $this->options['id']; $js = "jQuery('#{$id}').multipleInput({$options});"; $this->getView()->registerJs($js); }