/**
     * @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
    }
 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
-1
 /**
  * @inheritdoc
  */
 public function registerAssets($view)
 {
     GridViewAsset::register($view);
 }
예제 #6
-1
 /**
  * @inheritdoc
  */
 public function registerAssets($view)
 {
     GridViewAsset::register($view);
     $view->registerJs('$(".audit_curl_post_toggle").click(function() {$(this).next().next().toggle().next().toggle(); });');
 }