Add an option to ignore pjax request on some links.

This commit is contained in:
Christophe BOULAIN
2014-03-04 10:21:11 +01:00
parent 0e1a23f013
commit 3daa177ea2
2 changed files with 7 additions and 0 deletions

View File

@ -61,6 +61,10 @@
var link = event.currentTarget var link = event.currentTarget
// Ignore links with data-pjax="0"
if ($(link).data('pjax')==0)
return
if (link.tagName.toUpperCase() !== 'A') if (link.tagName.toUpperCase() !== 'A')
throw "$.fn.pjax or $.pjax.click requires an anchor element" throw "$.fn.pjax or $.pjax.click requires an anchor element"

View File

@ -88,6 +88,7 @@ class ActionColumn extends Column
$this->buttons['view'] = function ($url, $model) { $this->buttons['view'] = function ($url, $model) {
return Html::a('<span class="glyphicon glyphicon-eye-open"></span>', $url, [ return Html::a('<span class="glyphicon glyphicon-eye-open"></span>', $url, [
'title' => Yii::t('yii', 'View'), 'title' => Yii::t('yii', 'View'),
'data-pjax' => '0',
]); ]);
}; };
} }
@ -95,6 +96,7 @@ class ActionColumn extends Column
$this->buttons['update'] = function ($url, $model) { $this->buttons['update'] = function ($url, $model) {
return Html::a('<span class="glyphicon glyphicon-pencil"></span>', $url, [ return Html::a('<span class="glyphicon glyphicon-pencil"></span>', $url, [
'title' => Yii::t('yii', 'Update'), 'title' => Yii::t('yii', 'Update'),
'data-pjax' => '0',
]); ]);
}; };
} }
@ -104,6 +106,7 @@ class ActionColumn extends Column
'title' => Yii::t('yii', 'Delete'), 'title' => Yii::t('yii', 'Delete'),
'data-confirm' => Yii::t('yii', 'Are you sure to delete this item?'), 'data-confirm' => Yii::t('yii', 'Are you sure to delete this item?'),
'data-method' => 'post', 'data-method' => 'post',
'data-pjax' => '0',
]); ]);
}; };
} }