public function renderSorter()
{
if ($this->sorter) {
$columns = ['' => Yii::t('YupeModule.yupe', '--sort by--')];
foreach ($this->dataProvider->model->getAttributes() as $attribute => $value) {
$columns[$attribute] = $this->dataProvider->model->getAttributeLabel($attribute);
}
$sorterName = sprintf('sorter-%s', $this->getId());
Yii::app()->getClientScript()->registerScript($sorterName, <<<JS
\$('body').on('click', '#{$sorterName}', function(event){
alert(\$(this).val());
event.preventDefault();
\$('#{$this->getId()}').yiiGridView('update',{
});
});
JS
);
return '<div class="pull-left">' . CHtml::dropDownList($sorterName, null, $columns, ['class' => 'form-control']) . '</div>';
}
}