Exemplo n.º 1
0
 public function registerClientScript()
 {
     $view = $this->getView();
     PjaxAsset::register($view);
     $js = $this->generateClientScript();
     if ($js !== '') {
         $view->registerJs($js);
     }
 }
Exemplo n.º 2
0
 public function registerClientScript()
 {
     $id = $this->options['id'];
     $this->clientOptions['push'] = $this->enablePushState;
     $this->clientOptions['replace'] = $this->enableReplaceState;
     $this->clientOptions['timeout'] = $this->timeout;
     $this->clientOptions['scrollTo'] = $this->scrollTo;
     $options = Json::encode($this->clientOptions);
     $linkSelector = Json::encode($this->linkSelector !== null ? $this->linkSelector : '#' . $id . ' a');
     $formSelector = Json::encode($this->formSelector !== null ? $this->formSelector : '#' . $id . ' form[data-pjax]');
     $basePoint = $this->basePoint === 'document' ? $this->basePoint : Json::encode($this->basePoint);
     $view = $this->getView();
     PjaxAsset::register($view);
     $js = "jQuery({$basePoint}).off('click', {$linkSelector});";
     $js .= "jQuery({$basePoint}).pjax({$linkSelector}, \"#{$id}\", {$options});";
     $js .= "\njQuery({$basePoint}).off('submit', {$formSelector});";
     $js .= "\njQuery({$basePoint}).on('submit', {$formSelector}, function (event) {jQuery.pjax.submit(event, '#{$id}', {$options});});";
     $view->registerJs($js);
 }
Exemplo n.º 3
0
 /**
  * Registers the needed JavaScript.
  */
 public function registerClientScript()
 {
     $id = $this->options['id'];
     $this->clientOptions['push'] = $this->enablePushState;
     $this->clientOptions['replace'] = $this->enableReplaceState;
     $this->clientOptions['timeout'] = $this->timeout;
     $this->clientOptions['scrollTo'] = $this->scrollTo;
     $options = Json::htmlEncode($this->clientOptions);
     $js = '';
     if ($this->linkSelector !== false) {
         $linkSelector = Json::htmlEncode($this->linkSelector !== null ? $this->linkSelector : '#' . $id . ' a');
         $js .= "jQuery(document).pjax({$linkSelector}, \"#{$id}\", {$options});";
     }
     if ($this->formSelector !== false) {
         $formSelector = Json::htmlEncode($this->formSelector !== null ? $this->formSelector : '#' . $id . ' form[data-pjax]');
         $submitEvent = Json::htmlEncode($this->submitEvent);
         $js .= "\njQuery(document).on({$submitEvent}, {$formSelector}, function (event) {jQuery.pjax.submit(event, '#{$id}', {$options});});";
     }
     $view = $this->getView();
     PjaxAsset::register($view);
     if ($js !== '') {
         $view->registerJs($js);
     }
 }
Exemplo n.º 4
0
use im\tree\widgets\JsTreeToolbar;
use im\tree\widgets\TreeDetails;
use yii\bootstrap\Modal;
use yii\helpers\Url;
use yii\web\JqueryAsset;
use yii\widgets\ActiveFormAsset;
use yii\widgets\PjaxAsset;
/* @var $this yii\web\View */
/* @var $searchModel im\catalog\models\CategorySearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Module::t('category', 'Categories');
$this->params['subtitle'] = Module::t('category', 'Categories list');
$this->params['breadcrumbs'][] = $this->title;
ActiveFormAsset::register($this);
JqueryAsset::register($this);
PjaxAsset::register($this);
$treeId = 'categories-tree';
$treeDetailsId = 'category-details';
$confirmationModalId = 'confirmation-modal';
?>
<div class="row">
    <div class="col-xs-4">
        <div class="box">
            <div class="box-header with-border">
                <h3 class="box-title"><?php 
echo $this->params['subtitle'];
?>
</h3>
                <div class="box-tools pull-right">
                    <form method="post" action="#">
                        <div class="input-group">
Exemplo n.º 5
0
 /**
  * Registers the needed JavaScript.
  */
 public function registerClientScript()
 {
     $id = $this->options['id'];
     $this->clientOptions['push'] = $this->enablePushState;
     $this->clientOptions['replace'] = $this->enableReplaceState;
     $this->clientOptions['timeout'] = $this->timeout;
     $this->clientOptions['scrollTo'] = $this->scrollTo;
     $options = Json::htmlEncode($this->clientOptions);
     $js = '';
     if ($this->linkSelector !== false) {
         $linkSelector = Json::htmlEncode($this->linkSelector !== null ? $this->linkSelector : '#' . $id . ' a');
         //$js .= "jQuery(document).pjax($linkSelector, \"#$id\", $options);";
         //fix
         $js .= '$(document).on(\'click\', ' . $linkSelector . ', function (event) {
             var container = $(this).closest(\'[data-pjax-container]\');
             if ($(this).attr("data-pjax-reload-id")) {
                 container = $("#" + $(this).attr("data-pjax-reload-id"));                    
             };
             if ("' . $id . '" != container.attr("id")) return true;
             $.pjax.click(event, "#' . $id . '", ' . $options . ');
         });';
     }
     if ($this->formSelector !== false) {
         $formSelector = Json::htmlEncode($this->formSelector !== null ? $this->formSelector : '#' . $id . ' form[data-pjax]');
         //$js .= "\njQuery(document).on('submit', $formSelector, function (event) {jQuery.pjax.submit(event, '#$id', $options);});";
         //fix
         $js .= 'jQuery(document).on(\'submit\', ' . $formSelector . ', function (event) {
             var container = $(this).closest(\'[data-pjax-container]\');
             if ($(this).attr("data-pjax-reload-id")) {
                 container = $("#" + $(this).attr("data-pjax-reload-id"));
             };
             if ("' . $id . '" != container.attr("id")) return true;
             jQuery.pjax.submit(event, "#' . $id . '", ' . $options . ');
         });';
     }
     $view = $this->getView();
     PjaxAsset::register($view);
     if ($js !== '') {
         $view->registerJs($js);
     }
 }