コード例 #1
0
    /**
     * @inheritdoc
     */
    public function init()
    {
        $script = <<<JS
jQuery(document).on('click', '.order-link', function(e) {

    e.preventDefault();
    var csrfToken = \$('meta[name="csrf-token"]').attr("content");
    var url = jQuery(this).attr('href');
    var obj = this;
    jQuery.ajax({
       method: 'post',
       url: url,
       data: {_csrf: csrfToken},
       success: function(data) {

           jQuery('#'+jQuery( obj ).closest( ".grid-view" ).attr('id')).yiiGridView("applyFilter");
       }
    });
});
JS;
        $view = $this->grid->getView();
        GridViewAsset::register($view);
        $view->registerJs($script);
        parent::init();
        // TODO: Change the autogenerated stub
    }
コード例 #2
0
 public function init()
 {
     parent::init();
     if (!isset($this->sortUrl)) {
         throw new InvalidConfigException("You must specify the sortUrl");
     }
     GridViewAsset::register($this->view);
     SortableGridViewAsset::register($this->view);
     $this->tableOptions['class'] .= ' sortable-grid-view';
     $this->rowOptions = function ($model, $key, $index, $grid) {
         return ['id' => "items[]_{$model->primaryKey}"];
     };
 }
コード例 #3
0
 /**
  * Runs the widget.
  */
 public function run()
 {
     $id = $this->options['id'];
     $options = Json::encode($this->getClientOptions());
     $view = $this->getView();
     GridViewAsset::register($view);
     $view->registerJs("jQuery('#{$id}').yiiGridView({$options});");
     parent::run();
 }
コード例 #4
0
ファイル: index.php プロジェクト: tsyrya/mybriop
use yii\bootstrap\Modal;
use yii\grid\GridViewAsset;
use kartik\date\DatePickerAsset;
use kartik\select2\Select2;
use kartik\touchspin\TouchSpinAsset;
use app\modules\plan_prospekt\Asset;
/**
 * @var $this View
 * @var $actionSubview string
 * @var $actionParams array
 * @var $gridParams array
 */
ActiveFormAsset::register($this);
TouchSpinAsset::register($this);
DatePickerAsset::register($this);
GridViewAsset::register($this);
Asset::register($this);
echo Html::beginTag('div', ['class' => 'planprospekt planprospekt-editor']);
echo Html::tag('h3', 'План проспект ' . Yii::$app->request->get('year'));
// workaround for kratik-select2 pjax loading bug
echo Html::tag('div', Select2::widget(['name' => 'stub']), ['class' => 'hidden']);
Modal::begin(['id' => 'modal-action', 'header' => '<h4></h4>']);
$this->registerJs('mybriop.planProspektEditor.modalDynamicOptionsInit("#modal-action");');
Pjax::begin(['id' => 'pjax-action', 'timeout' => 3500]);
if (isset($actionSubview) && isset($actionParams)) {
    $indexUrl = $actionParams['indexUrl'];
    $modalMethod = $actionParams['model'] !== null ? "show" : "hide";
    $this->registerJs('mybriop.planProspektEditor.modalHiddenHandlerInit("#modal-action", "#pjax-grid", "' . $indexUrl . '");');
    $this->registerJs('$("#modal-action").modal("' . $modalMethod . '");');
    echo $this->render($actionSubview, $actionParams);
}
コード例 #5
0
ファイル: assets.php プロジェクト: shinkarenko/playground
<?php

/**
 * Configuration file for the "yii asset" console command.
 * Note that in the console environment, some path aliases like '@webroot' and '@web' may not exist.
 * Please define these missing path aliases.
 */
return ['jsCompressor' => 'java -jar /root/compiler.jar --js {from} --js_output_file {to}', 'cssCompressor' => 'yui-compressor --type css {from} -o {to}', 'bundles' => ['app\\assets\\AppAsset', 'yii\\bootstrap\\BootstrapAsset', 'app\\modules\\admin\\assets\\AdminAsset', \dmstr\web\AdminLteAsset::className(), \yii\grid\GridViewAsset::className(), \yii\widgets\PjaxAsset::className()], 'targets' => ['frontend' => ['class' => 'yii\\web\\AssetBundle', 'basePath' => '@app/web/assets-prod', 'baseUrl' => '@web/assets-prod', 'js' => 'js/frontend-{hash}.js', 'css' => 'css/frontend-{hash}.css', 'depends' => ['app\\assets\\AppAsset']], 'backend' => ['class' => 'yii\\web\\AssetBundle', 'basePath' => '@app/web/assets-prod', 'baseUrl' => '@web/assets-prod', 'js' => 'js/backend-{hash}.js', 'css' => 'css/backend-{hash}.css', 'depends' => ['app\\modules\\admin\\assets\\AdminAsset', \dmstr\web\AdminLteAsset::className()]], 'all' => ['class' => 'yii\\web\\AssetBundle', 'basePath' => '@app/web/assets-prod', 'baseUrl' => '@web/assets-prod', 'js' => 'js/all-{hash}.js', 'css' => 'css/all-{hash}.css']], 'assetManager' => ['basePath' => '/app/web/assets-prod', 'baseUrl' => '/assets-prod']];
コード例 #6
-1
 /**
  * @inheritdoc
  */
 public function registerAssets($view)
 {
     GridViewAsset::register($view);
 }
コード例 #7
-1
 /**
  * @inheritdoc
  */
 public function registerAssets($view)
 {
     GridViewAsset::register($view);
     $view->registerJs('$(".audit_curl_post_toggle").click(function() {$(this).next().next().toggle().next().toggle(); });');
 }