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