mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-26 06:15:19 +08:00
docs/guide pjax descriptions improved.
This commit is contained in:
@ -140,8 +140,8 @@ Working with Pjax <span id="working-with-pjax"></span>
|
||||
-----------------------
|
||||
|
||||
The [[yii\widgets\Pjax|Pjax]] widget allows you to update a certain section of a
|
||||
page instead of reloading the entire page. You can use it to update the form
|
||||
only or replace its contents after the submission.
|
||||
page instead of reloading the entire page. You can use it to update only the form
|
||||
and replace its contents after the submission.
|
||||
|
||||
You can configure [[yii\widgets\Pjax::$formSelector|$formSelector]] to specify
|
||||
which form submission may trigger pjax. If not set, all forms with `data-pjax`
|
||||
@ -153,19 +153,19 @@ use yii\widgets\ActiveForm;
|
||||
|
||||
Pjax::begin([
|
||||
// Pjax options
|
||||
])
|
||||
]);
|
||||
$form = ActiveForm::begin([
|
||||
'options' => ['data' => ['pjax' => true]],
|
||||
// more ActiveForm options
|
||||
])
|
||||
]);
|
||||
|
||||
// ActiveForm content
|
||||
|
||||
ActiveForm::end();
|
||||
Pjax::end();
|
||||
```
|
||||
> Tip: Be careful with links inside the [[yii\widgets\Pjax|Pjax]] widget since
|
||||
> the response will also be rendered inside the widget, to prevent this use the
|
||||
> Tip: Be careful with the links inside the [[yii\widgets\Pjax|Pjax]] widget since
|
||||
> the response will also be rendered inside the widget. To prevent this, use the
|
||||
> `data-pjax="0"` HTML attribute.
|
||||
|
||||
#### Values in Submit Buttons and File Upload
|
||||
|
@ -714,16 +714,16 @@ Pjax::begin([
|
||||
Pjax::end();
|
||||
```
|
||||
|
||||
[[yii\widgets\Pjax|Pjax]] also works for links following the
|
||||
[[yii\widgets\Pjax::$linkSelector|Pjax::$linkSelector]] which might be a problem when
|
||||
using [[yii\data\ActionColumn|ActionColumn]]. To prevent this, add the HTML attribute
|
||||
`data-pjax="0"` to links when you edit the
|
||||
[[yii\data\ActionColumn::$buttons|ActionColumn::$buttons]] property.
|
||||
Pjax also works for the links inside the [[yii\widgets\Pjax|Pjax]] widget and
|
||||
for the links specified by [[yii\widgets\Pjax::$linkSelector|Pjax::$linkSelector]].
|
||||
But this might be a problem for the links of an [[yii\data\ActionColumn|ActionColumn]].
|
||||
To prevent this, add the HTML attribute `data-pjax="0"` to the links when you edit
|
||||
the [[yii\data\ActionColumn::$buttons|ActionColumn::$buttons]] property.
|
||||
|
||||
#### GridView with Pjax in Gii
|
||||
#### GridView/ListView with Pjax in Gii
|
||||
|
||||
Since 2.0.5 [Gii](start-gii.md) the option `$enablePjax` can be used via either
|
||||
web interface or command line.
|
||||
Since 2.0.5, the CRUD generator of [Gii](start-gii.md) has an option called
|
||||
`$enablePjax` that can be used via either web interface or command line.
|
||||
|
||||
```php
|
||||
yii gii/crud --controllerClass="backend\\controllers\PostController" \
|
||||
|
Reference in New Issue
Block a user