Exemplo n.º 1
0
 public function registerClientScript()
 {
     if ($this->ajaxUpdate === false) {
         return;
     }
     parent::registerClientScript();
 }
Exemplo n.º 2
0
 /**
  * Register client script
  */
 public function registerClientScript()
 {
     parent::registerClientScript();
     if ($this->enablePageSizing) {
         Yii::app()->getClientScript()->registerScript(__CLASS__ . '#' . $this->id . '-page-size', "\n\t\t\t\t\$(document).on('change', '#{$this->id}-page-size', function(){\n\t\t\t\t\t\$.fn.yiiListView.update('{$this->id}',{data: { '{$this->id}-page-size': \$(this).val()}});\n\t\t\t\t\treturn false;\n\t\t\t\t});\n\t\t\t");
     }
 }
Exemplo n.º 3
0
 private function getWidgetScript($callback1, $callback2)
 {
     Yii::import('zii.widgets.CListView');
     Yii::app()->clientScript->scripts = array();
     ob_start();
     $widget = new CListView(null);
     $widget->beforeAjaxUpdate = $callback1;
     $widget->afterAjaxUpdate = $callback2;
     $widget->itemView = 'dummy';
     $widget->dataProvider = new CArrayDataProvider(array(1, 2, 3));
     $widget->init();
     $widget->registerClientScript();
     Yii::app()->clientScript->render($out);
     ob_end_clean();
     return $out;
 }
Exemplo n.º 4
0
 public function registerClientScript()
 {
     if (!Yii::app()->request->isAjaxRequest) {
         parent::registerClientScript();
         $cs = Yii::app()->clientScript;
         $basePath = Yii::getPathOfAlias('ext.NPager.assets');
         $baseUrl = Yii::app()->getAssetManager()->publish($basePath);
         $id = parent::getId();
         $cs = Yii::app()->clientScript;
         $cs->registerCoreScript('jquery');
         $js = "function {$id}" . "_changePageSize(id,url)\n";
         $js .= "{\n";
         $js .= "    url = {url:url+\$('#'+id+'>.{$this->pagerlistCssClass}>select').val()};\n";
         $js .= "    \$.fn.yiiListView.update(id,url);\n";
         $js .= "}\n";
         $js .= "\n";
         $cs->registerScript($this->getId(), $js, CClientScript::POS_END);
         $cs->registerCssFile($baseUrl . '/style.css');
     }
 }
Exemplo n.º 5
0
 public function registerClientScript()
 {
     if ($this->front === false) {
         parent::registerClientScript();
     }
 }