Skip to content

Commit

Permalink
PJAX related enhancements fixes #431 & fixes #432
Browse files Browse the repository at this point in the history
  • Loading branch information
kartik-v committed Jan 10, 2016
1 parent 5e190a8 commit e1234ef
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
6 changes: 3 additions & 3 deletions CHANGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ Change Log: `yii2-grid`

## Version 3.0.9

**Date:** 30-Dec-2015
**Date:** 10-Jan-2016

1. (enh #410, #413): Add Thai translations.
2. (bug #415): Fix double quote replace in csv export.
3. (enh #419): Create new `EditableColumnAction` class.
4. (enh #420): Enhance EditableColumn to pass current model `attribute` as ajax posted data.
5. (bug #421): Eliminate garbage characters in `kv-grid-export.min.js`.
6. Sort entries in message files.
5. (enh #431): Disable PJAX pushState by default to avoid plugin conflict on browser back forward.
6. (enh #432): Enhancements for PJAX reinitialization.

## Version 3.0.8

Expand Down
8 changes: 3 additions & 5 deletions ColumnTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -434,8 +434,8 @@ protected function initPjax($script = '')
}
$cont = 'jQuery("#' . $this->grid->pjaxSettings['options']['id'] . '")';
$view = $this->grid->getView();
$event = 'pjax:complete.' . hash('crc32', $script);
$view->registerJs("{$cont}.off('{$event}').on('{$event}', function(){{$script}});");
$ev = 'pjax:complete.' . hash('crc32', $script);
$view->registerJs("{$cont}.off('{$ev}').on('{$ev}', function(){ {$script} });");
}

/**
Expand All @@ -450,9 +450,7 @@ protected function initPjax($script = '')
*/
protected function parseVal($var, $model, $key, $index)
{
return $var instanceof Closure ?
call_user_func($var, $model, $key, $index, $this) :
$var;
return $var instanceof Closure ? call_user_func($var, $model, $key, $index, $this) : $var;
}

/**
Expand Down
4 changes: 4 additions & 0 deletions DataColumn.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
namespace kartik\grid;

use Closure;
use kartik\base\Config;
use yii\helpers\ArrayHelper;
use yii\helpers\Html;

Expand Down Expand Up @@ -350,6 +351,9 @@ protected function renderFilterCellContent()
'options' => $this->filterInputOptions
];
if (is_array($this->filter)) {
if (Config::isInputWidget($this->filterType)) {
$options['pjaxContainerId'] = $this->grid->pjaxSettings['options']['id'];
}
if ($this->filterType === GridView::FILTER_SELECT2 || $this->filterType === GridView::FILTER_TYPEAHEAD) {
$options['data'] = $this->filter;
}
Expand Down
3 changes: 3 additions & 0 deletions GridView.php
Original file line number Diff line number Diff line change
Expand Up @@ -1320,6 +1320,9 @@ protected function beginPjax()
if ($js != $container) {
$view->registerJs("{$js};");
}
if (!isset($this->pjaxSettings['options']['enablePushState'])) {
$this->pjaxSettings['options']['enablePushState'] = false;
}
Pjax::begin($this->pjaxSettings['options']);
echo ArrayHelper::getValue($this->pjaxSettings, 'beforeGrid', '');
}
Expand Down

0 comments on commit e1234ef

Please sign in to comment.