I tried to set a filter in gridview for a string attribute with typehead widget, but I get the error above.
use app\models\Person;
use yii\helpers\ArrayHelper;
use kartik\helpers\Html;
use kartik\grid\GridView;
...
[
'attribute'=>'position',
'value'=>'position',
'filterType'=>GridView::FILTER_TYPEAHEAD,
'filter'=>ArrayHelper::map(Person::find()->orderBy('position')->asArray()->all(), 'id', 'position'),
'filterWidgetOptions'=>[
'pluginOptions' => ['allowClear' => true],
],
'filterInputOptions' => ['placeholder' => 'Type a position'],
'format'=>'raw'
],
1. in C:\xampp-portable\htdocs\yii2\vendor\kartik-v\yii2-widgets\widgets\Typeahead.php at line 78
69707172737475767778798081828384858687 /**
* Runs the widget
*
* @return string|void
* @throws \yii\base\InvalidConfigException
*/
public function run()
{
if (empty($this->dataset) || !is_array($this->dataset)) {
throw new InvalidConfigException("You must define the 'dataset' property for Typeahead which must be an array.");
}
if (!is_array(current($this->dataset))) {
throw new InvalidConfigException("The 'dataset' array must contain an array of datums. Invalid data found.");
}
$this->validateConfig();
$this->initDataset();
$this->registerAssets();
$this->initOptions();
echo Html::tag('div', $this->getInput('textInput'), $this->container);
2. in C:\xampp-portable\htdocs\yii2\vendor\yiisoft\yii2\base\Widget.php – kartik\widgets\Typeahead::run() at line 96
3. in C:\xampp-portable\htdocs\yii2\vendor\kartik-v\yii2-grid\grid\DataColumn.php – yii\base\Widget::widget(['model' => app\models\search\PersonSearch, 'attribute' => 'position', 'options' => ['placeholder' => 'Type a position'], 'data' => [5 => null, 6 => null, 7 => null, 2 => '', ...], ...]) at line 156
150151152153154155156157158159160161162 }
}
if ($this->filterType === GridView::FILTER_CHECKBOX) {
return Html::activeCheckbox($this->grid->filterModel, $this->attribute, $this->filterInputOptions);
}
$options += $this->filterWidgetOptions;
return $widgetClass::widget($options);
}
/**
* Renders the header cell.
*/
public function renderHeaderCell()
4. in C:\xampp-portable\htdocs\yii2\vendor\yiisoft\yii2\grid\Column.php – kartik\grid\DataColumn::renderFilterCellContent() at line 110
5. in C:\xampp-portable\htdocs\yii2\vendor\kartik-v\yii2-grid\grid\DataColumn.php – yii\grid\Column::renderFilterCell() at line 179
173174175176177178179180181182183184185 */
public function renderFilterCell()
{
if ($this->grid->filterModel !== null && $this->mergeHeader && $this->grid->filterPosition === GridView::FILTER_POS_BODY) {
return null;
}
return parent::renderFilterCell();
}
/**
* Store all rows for the column for the current page
*/
protected function setPageRows()
6. in C:\xampp-portable\htdocs\yii2\vendor\yiisoft\yii2\grid\GridView.php – kartik\grid\DataColumn::renderFilterCell() at line 400
7. in C:\xampp-portable\htdocs\yii2\vendor\yiisoft\yii2\grid\GridView.php – yii\grid\GridView::renderFilters() at line 365
8. in C:\xampp-portable\htdocs\yii2\vendor\yiisoft\yii2\grid\GridView.php – yii\grid\GridView::renderTableHeader() at line 297
9. in C:\xampp-portable\htdocs\yii2\vendor\yiisoft\yii2\widgets\BaseListView.php – yii\grid\GridView::renderItems() at line 136
10. in C:\xampp-portable\htdocs\yii2\vendor\yiisoft\yii2\grid\GridView.php – yii\widgets\BaseListView::renderSection('{items}') at line 267
11. in C:\xampp-portable\htdocs\yii2\vendor\yiisoft\yii2\widgets\BaseListView.php – yii\grid\GridView::renderSection('{items}') at line 113
12. yii\widgets\BaseListView::yii\widgets\{closure}(['{items}'])
13. in C:\xampp-portable\htdocs\yii2\vendor\yiisoft\yii2\widgets\BaseListView.php – preg_replace_callback('/{\w+}/', Closure, ' <div class="panel panel-defa...') at line 116
14. in C:\xampp-portable\htdocs\yii2\vendor\yiisoft\yii2\grid\GridView.php – yii\widgets\BaseListView::run() at line 242
15. in C:\xampp-portable\htdocs\yii2\vendor\kartik-v\yii2-grid\grid\GridView.php – yii\grid\GridView::run() at line 418
412413414415416417418419420421422423424 else {
$this->layout = strtr($this->layout, ['{toolbar}' => $this->toolbar]);
}
if ($this->bootstrap && $this->responsive) {
$this->layout = str_replace('{items}', '<div class="table-responsive">{items}</div>', $this->layout);
}
parent::run();
}
/**
* Sets the grid layout based on the template and panel settings
*/
protected function renderPanel()
16. in C:\xampp-portable\htdocs\yii2\vendor\yiisoft\yii2\base\Widget.php – kartik\grid\GridView::run() at line 96
17. in C:\xampp-portable\htdocs\yii2\views\person\index.php – yii\base\Widget::widget(['dataProvider' => yii\data\ActiveDataProvider, 'filterModel' => app\models\search\PersonSearch, 'columns' => [['class' => 'kartik\grid\SerialColumn'], ['attribute' => 'title', 'value' => 'title', 'filterType' => '\kartik\widgets\Select2', 'filter' => ['' => '', 'Ifj.' => 'Ifj.', 'Id.' => 'Id.', 'Prof.' => 'Prof.', ...], ...], 'fullName', ['attribute' => 'company_id', 'value' => Closure, 'filterType' => '\kartik\widgets\Select2', 'filter' => [16 => '168 óra', 17 => '90.9 Jazzy ', 18 => 'A42 Kft.', 19 => 'AAM Consulting', ...], ...], ...], 'floatHeader' => true, ...]) at line 90
848586878889909192 'panel' => [
'heading'=>'<h3 class="panel-title"><i class="glyphicon glyphicon-globe"></i> '.$this->title.'</h3>',
'before'=>Html::a('<i class="glyphicon glyphicon-plus"></i> '.Yii::t('app', 'Create {modelClass}',
['modelClass' => 'Person',]),
['create'], ['class' => 'btn btn-success']),
],
]); ?>
</div>
18. in C:\xampp-portable\htdocs\yii2\vendor\yiisoft\yii2\base\View.php – require('C:\xampp-portable\htdocs\yii2\vi...') at line 315
19. in C:\xampp-portable\htdocs\yii2\vendor\yiisoft\yii2\base\View.php – yii\base\View::renderPhpFile('C:\xampp-portable\htdocs\yii2\vi...', ['dataProvider' => yii\data\ActiveDataProvider, 'searchModel' => app\models\search\PersonSearch]) at line 247
20. in C:\xampp-portable\htdocs\yii2\vendor\yiisoft\yii2\base\View.php – yii\base\View::renderFile('C:\xampp-portable\htdocs\yii2\vi...', ['dataProvider' => yii\data\ActiveDataProvider, 'searchModel' => app\models\search\PersonSearch], app\controllers\PersonController) at line 149
21. in C:\xampp-portable\htdocs\yii2\vendor\yiisoft\yii2\base\Controller.php – yii\base\View::render('index', ['dataProvider' => yii\data\ActiveDataProvider, 'searchModel' => app\models\search\PersonSearch], app\controllers\PersonController) at line 362
22. in C:\xampp-portable\htdocs\yii2\controllers\PersonController.php – yii\base\Controller::render('index', ['dataProvider' => yii\data\ActiveDataProvider, 'searchModel' => app\models\search\PersonSearch]) at line 52
46474849505152535455565758 $searchModel = new PersonSearch;
$dataProvider = $searchModel->search(Yii::$app->request->getQueryParams());
return $this->render('index', [
'dataProvider' => $dataProvider,
'searchModel' => $searchModel,
]);
}
/**
* Displays a single Person model.
* @param integer $id
* @return mixed
23. app\controllers\PersonController::actionIndex()
24. in C:\xampp-portable\htdocs\yii2\vendor\yiisoft\yii2\base\InlineAction.php – call_user_func_array([app\controllers\PersonController, 'actionIndex'], []) at line 54
25. in C:\xampp-portable\htdocs\yii2\vendor\yiisoft\yii2\base\Controller.php – yii\base\InlineAction::runWithParams([]) at line 147
26. in C:\xampp-portable\htdocs\yii2\vendor\yiisoft\yii2\base\Module.php – yii\base\Controller::runAction('index', []) at line 423
27. in C:\xampp-portable\htdocs\yii2\vendor\yiisoft\yii2\web\Application.php – yii\base\Module::runAction('person/index', []) at line 82
28. in C:\xampp-portable\htdocs\yii2\vendor\yiisoft\yii2\base\Application.php – yii\web\Application::handleRequest(yii\web\Request) at line 355
29. in C:\xampp-portable\htdocs\yii2\web\index.php – yii\base\Application::run() at line 12
6789101112
require(__DIR__ . '/../vendor/autoload.php');
require(__DIR__ . '/../vendor/yiisoft/yii2/Yii.php');
$config = require(__DIR__ . '/../config/web.php');
(new yii\web\Application($config))->run();
$_SERVER = array (
'REDIRECT_MIBDIRS' => '/xampp-portable/php/extras/mibs',
'REDIRECT_MYSQL_HOME' => '\\xampp\\mysql\\bin',
'REDIRECT_OPENSSL_CONF' => '/xampp-portable/apache/bin/openssl.cnf',
'REDIRECT_PHP_PEAR_SYSCONF_DIR' => '\\xampp\\php',
'REDIRECT_PHPRC' => '\\xampp\\php',
'REDIRECT_TMP' => '\\xampp\\tmp',
'REDIRECT_STATUS' => '200',
'MIBDIRS' => '/xampp-portable/php/extras/mibs',
'MYSQL_HOME' => '\\xampp\\mysql\\bin',
'OPENSSL_CONF' => '/xampp-portable/apache/bin/openssl.cnf',
'PHP_PEAR_SYSCONF_DIR' => '\\xampp\\php',
'PHPRC' => '\\xampp\\php',
'TMP' => '\\xampp\\tmp',
'HTTP_HOST' => 'localhost',
'HTTP_CONNECTION' => 'keep-alive',
'HTTP_CACHE_CONTROL' => 'max-age=0',
'HTTP_ACCEPT' => 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
'HTTP_USER_AGENT' => 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.137 Safari/537.36',
'HTTP_REFERER' => 'http://localhost/yii2/web/company/index',
'HTTP_ACCEPT_ENCODING' => 'gzip,deflate,sdch',
'HTTP_ACCEPT_LANGUAGE' => 'hu,en-US;q=0.8,en;q=0.6',
'HTTP_COOKIE' => '_csrf=5d930bb1f1d3c739662cd783d2b56af4508584b5e08a1864e6a8ca46ea60dda0s%3A32%3A%22M4r5A7lx5LaSMjnHO373LfKPWwmcbpnV%22%3B; PHPSESSID=8pbd2er1chqqci2sct09sue8l7; _identity=ac3866e7f6fd9cf36ddca8bac9609f4fe11b02b0be1e332cf356622a89e25457s%3A46%3A%22%5B1%2C%22Lzo7ifYdKsuviydfhuAK5PYf5ltNLsnN%22%2C2592000%5D%22%3B',
'PATH' => 'C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\xampp-portable\\php;C:\\Program Files (x86)\\PDFtk\\bin\\;C:\\ProgramData\\ComposerSetup\\bin;C:\\Windows\\idmu\\common',
'SystemRoot' => 'C:\\Windows',
'COMSPEC' => 'C:\\Windows\\system32\\cmd.exe',
'PATHEXT' => '.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC',
'WINDIR' => 'C:\\Windows',
'SERVER_SIGNATURE' => '
Apache/2.4.3 (Win32) OpenSSL/1.0.1c PHP/5.4.7 Server at localhost Port 80
',
'SERVER_SOFTWARE' => 'Apache/2.4.3 (Win32) OpenSSL/1.0.1c PHP/5.4.7',
'SERVER_NAME' => 'localhost',
'SERVER_ADDR' => '::1',
'SERVER_PORT' => '80',
'REMOTE_ADDR' => '::1',
'DOCUMENT_ROOT' => 'C:/xampp-portable/htdocs',
'REQUEST_SCHEME' => 'http',
'CONTEXT_PREFIX' => '',
'CONTEXT_DOCUMENT_ROOT' => 'C:/xampp-portable/htdocs',
'SERVER_ADMIN' => 'postmaster@localhost',
'SCRIPT_FILENAME' => 'C:/xampp-portable/htdocs/yii2/web/index.php',
'REMOTE_PORT' => '54267',
'REDIRECT_URL' => '/yii2/web/person/index',
'GATEWAY_INTERFACE' => 'CGI/1.1',
'SERVER_PROTOCOL' => 'HTTP/1.1',
'REQUEST_METHOD' => 'GET',
'QUERY_STRING' => '',
'REQUEST_URI' => '/yii2/web/person/index',
'SCRIPT_NAME' => '/yii2/web/index.php',
'PHP_SELF' => '/yii2/web/index.php',
'REQUEST_TIME_FLOAT' => 1400273378.348,
'REQUEST_TIME' => 1400273378,
);