protected function initColumnSelector()
{
if (!$this->_columnSelectorEnabled) {
return;
}
$selector = [];
Html::addCssClass($this->columnSelectorOptions, 'btn btn-default dropdown-toggle');
$header = ArrayHelper::getValue($this->columnSelectorOptions, 'header', Yii::t('kvexport', 'Select Columns'));
$this->columnSelectorOptions['header'] = empty($header) || $header === false ? '' : '<li class="dropdown-header">' . $header . '</li><li class="kv-divider"></li>';
$id = $this->options['id'] . '-cols';
Html::addCssClass($this->columnSelectorMenuOptions, 'dropdown-menu kv-checkbox-list');
$this->columnSelectorMenuOptions = array_replace_recursive(['id' => $id . '-list', 'role' => 'menu', 'aria-labelledby' => $id], $this->columnSelectorMenuOptions);
$this->columnSelectorOptions = array_replace_recursive(['id' => $id, 'icon' => '<i class="glyphicon glyphicon-list"></i>', 'title' => Yii::t('kvexport', 'Select columns to export'), 'type' => 'button', 'data-toggle' => 'dropdown', 'aria-haspopup' => 'true', 'aria-expanded' => 'false'], $this->columnSelectorOptions);
foreach ($this->columns as $key => $column) {
$selector[$key] = $this->getColumnLabel($key, $column);
}
$this->columnSelector = array_replace($selector, $this->columnSelector);
if (!isset($this->selectedColumns)) {
$keys = array_keys($this->columnSelector);
$this->selectedColumns = array_combine($keys, $keys);
}
}