예제 #1
0
 /**
  * Register client script
  */
 protected function registerClientScript()
 {
     $view = $this->getView();
     switch ($this->type) {
         case 'address':
             EditableAddressAsset::register($view);
             break;
         case 'combodate':
             EditableComboDateAsset::register($view);
             break;
         case 'date':
             EditableDatePickerAsset::register($view);
             break;
         case 'datetime':
             EditableDateTimePickerAsset::register($view);
             break;
         default:
             EditableBootstrapAsset::register($view);
     }
     $id = ArrayHelper::remove($this->pluginOptions, 'selector', '#' . $this->options['id']);
     $id = preg_replace('/([.])/', '\\\\\\\\$1', $id);
     if ($this->hasActiveRecord() && $this->model->isNewRecord) {
         $this->pluginOptions['send'] = 'always';
         // send to server without pk
     }
     $pluginOptions = $this->getPluginOptions();
     $js = "jQuery('{$id}').editable({$pluginOptions});";
     $view->registerJs($js);
     if (!empty($this->clientEvents)) {
         $this->registerClientEvents($id);
     }
 }
예제 #2
0
 /**
  * Registers required script to the columns work
  */
 protected function registerClientScript()
 {
     $view = $this->grid->getView();
     switch ($this->type) {
         case 'address':
             EditableAddressAsset::register($view);
             break;
         case 'combodate':
             EditableComboDateAsset::register($view);
             break;
         case 'date':
             EditableDatePickerAsset::register($view);
             break;
         case 'datetime':
             EditableDateTimePickerAsset::register($view);
             break;
         default:
             EditableBootstrapAsset::register($view);
     }
     $rel = $this->options['rel'];
     $selector = "a[rel=\"{$rel}\"]";
     $js[] = ";jQuery('{$selector}').editable();";
     $view->registerJs(implode("\n", $js));
 }