Commit 823227fc by Qiang Xue

Added Pjax::timeout and clientOptions.

parent f5f5538d
...@@ -58,6 +58,15 @@ class Pjax extends Widget ...@@ -58,6 +58,15 @@ class Pjax extends Widget
* @var boolean whether to enable replace state. * @var boolean whether to enable replace state.
*/ */
public $enableReplaceState = false; public $enableReplaceState = false;
/**
* @var integer pjax timeout setting (in milliseconds)
*/
public $timeout = 1000;
/**
* @var array additional options to be passed to the pjax JS plugin. Please refer to
* [pjax project page](https://github.com/defunkt/jquery-pjax) for available options.
*/
public $clientOptions;
/** /**
* @inheritdoc * @inheritdoc
...@@ -131,10 +140,10 @@ class Pjax extends Widget ...@@ -131,10 +140,10 @@ class Pjax extends Widget
public function registerClientScript() public function registerClientScript()
{ {
$id = $this->options['id']; $id = $this->options['id'];
$options = Json::encode([ $this->clientOptions['push'] = $this->enablePushState;
'push' => $this->enablePushState, $this->clientOptions['replace'] = $this->enableReplaceState;
'replace' => $this->enableReplaceState, $this->clientOptions['timeout'] = $this->timeout;
]); $options = Json::encode($this->clientOptions);
$linkSelector = Json::encode($this->linkSelector !== null ? $this->linkSelector : '#' . $id . ' a'); $linkSelector = Json::encode($this->linkSelector !== null ? $this->linkSelector : '#' . $id . ' a');
$view = $this->getView(); $view = $this->getView();
PjaxAsset::register($view); PjaxAsset::register($view);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment