headerOptions['width'])) {
$this->headerOptions['width'] = $this->width;
}
}
/**
* @inheritdoc
*/
protected function renderHeaderCellContent()
{
if ($this->header !== null || !$this->multiple) {
return parent::renderHeaderCellContent();
} else {
static $i = 1;
$unique = uniqid() . $i;
$i++;
$for = 'inlineCheckbox' . $unique;
$options['id'] = $for;
$options['class'] = 'select-on-check-all';
return "" . Html::checkbox($this->getHeaderCheckBoxName(), false, $options) . "";
}
}
/**
* @inheritdoc
*/
protected function renderDataCellContent($model, $key, $index)
{
if ($this->checkboxOptions instanceof Closure) {
$options = call_user_func($this->checkboxOptions, $model, $key, $index, $this);
} else {
$options = $this->checkboxOptions;
}
if (!isset($options['value'])) {
$options['value'] = is_array($key) ? Json::encode($key) : $key;
}
if ($this->cssClass !== null) {
Html::addCssClass($options, $this->cssClass);
}
static $i = 1;
$unique = uniqid() . $i;
$i++;
$for = 'inlineCheckbox' . $unique;
$options['id'] = $for;
return "" . Html::checkbox($this->name, !empty($options['checked']), $options) . "";
}
}