PHP 클래스 yii\widgets\Pjax

Pjax only deals with the content enclosed between its [[begin()]] and [[end()]] calls, called the *body content* of the widget. By default, any link click or form submission (for those forms with data-pjax attribute) within the body content will trigger an AJAX request. In responding to the AJAX request, Pjax will send the updated body content (based on the AJAX request) to the client which will replace the old content with the new one. The browser's URL will then be updated using pushState. The whole process requires no reloading of the layout or resources (js, css). You may configure [[linkSelector]] to specify which links should trigger pjax, and configure [[formSelector]] to specify which form submission may trigger pjax. You may disable pjax for a specific link inside the container by adding data-pjax="0" attribute to this link. The following example shows how to use Pjax with the GridView widget so that the grid pagination, sorting and filtering can be done via pjax: php use yii\widgets\Pjax; Pjax::begin(); echo GridView::widget([...]); Pjax::end();
부터: 2.0
저자: Qiang Xue ([email protected])
상속: extends yii\base\Widget
파일 보기 프로젝트 열기: yiisoft/yii2 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$clientOptions additional options to be passed to the pjax JS plugin. Please refer to the pjax project page for available options.
$enablePushState whether to enable push state.
$enableReplaceState whether to enable replace state.
$formSelector the jQuery selector of the forms whose submissions should trigger pjax requests. If not set, all forms with data-pjax attribute within the enclosed content of Pjax will trigger pjax requests. If set to false, no code will be registered to handle forms. Note that if the response to the pjax request is a full page, a normal request will be sent again.
$linkSelector the jQuery selector of the links that should trigger pjax requests. If not set, all links within the enclosed content of Pjax will trigger pjax requests. If set to false, no code will be registered to handle links. Note that if the response to the pjax request is a full page, a normal request will be sent again.
$options the HTML attributes for the widget container tag. The following special options are recognized: - tag: string, the tag name for the container. Defaults to div This option is available since version 2.0.7. See also [[\yii\helpers\Html::tag()]].
$scrollTo how to scroll the page when pjax response is received. If false, no page scroll will be made. Use a number if you want to scroll to a particular place.
$submitEvent The jQuery event that will trigger form handler. Defaults to "submit".
$timeout pjax timeout setting (in milliseconds). This timeout is used when making AJAX requests. Use a bigger number if your server is slow. If the server does not respond within the timeout, a full page load will be triggered.

공개 메소드들

메소드 설명
init ( )
registerClientScript ( ) Registers the needed JavaScript.
run ( )

보호된 메소드들

메소드 설명
requiresPjax ( ) : boolean

메소드 상세

init() 공개 메소드

public init ( )

registerClientScript() 공개 메소드

Registers the needed JavaScript.

requiresPjax() 보호된 메소드

protected requiresPjax ( ) : boolean
리턴 boolean whether the current request requires pjax response from this widget

run() 공개 메소드

public run ( )

프로퍼티 상세

$clientOptions 공개적으로 프로퍼티

additional options to be passed to the pjax JS plugin. Please refer to the pjax project page for available options.
public $clientOptions

$enablePushState 공개적으로 프로퍼티

whether to enable push state.
public $enablePushState

$enableReplaceState 공개적으로 프로퍼티

whether to enable replace state.
public $enableReplaceState

$formSelector 공개적으로 프로퍼티

the jQuery selector of the forms whose submissions should trigger pjax requests. If not set, all forms with data-pjax attribute within the enclosed content of Pjax will trigger pjax requests. If set to false, no code will be registered to handle forms. Note that if the response to the pjax request is a full page, a normal request will be sent again.
public $formSelector

$linkSelector 공개적으로 프로퍼티

the jQuery selector of the links that should trigger pjax requests. If not set, all links within the enclosed content of Pjax will trigger pjax requests. If set to false, no code will be registered to handle links. Note that if the response to the pjax request is a full page, a normal request will be sent again.
public $linkSelector

$options 공개적으로 프로퍼티

the HTML attributes for the widget container tag. The following special options are recognized: - tag: string, the tag name for the container. Defaults to div This option is available since version 2.0.7. See also [[\yii\helpers\Html::tag()]].
또한 보기: yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered.
public $options

$scrollTo 공개적으로 프로퍼티

how to scroll the page when pjax response is received. If false, no page scroll will be made. Use a number if you want to scroll to a particular place.
public $scrollTo

$submitEvent 공개적으로 프로퍼티

The jQuery event that will trigger form handler. Defaults to "submit".
부터: 2.0.9
public $submitEvent

$timeout 공개적으로 프로퍼티

pjax timeout setting (in milliseconds). This timeout is used when making AJAX requests. Use a bigger number if your server is slow. If the server does not respond within the timeout, a full page load will be triggered.
public $timeout