-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Name of action column #150
Comments
Set the |
In this part of the code the column label is defined from the configuration array: protected function getColumnLabel($key, $column)
{
if (is_string($column)) {
$matches = $this->matchColumnString($column);
$attribute = $matches[1];
if (isset($matches[5])) {
return $matches[5];
} //header specified is in the format "attribute:format:label"
return $this->getAttributeLabel($attribute);
} else {
$label = $key;
if (is_array($column)) {
if (!empty($column['label'])) {
$label = $column['label'];
} elseif (!empty($column['header'])) {
$label = $column['header'];
} elseif (!empty($column['attribute'])) {
$label = $this->getAttributeLabel($column['attribute']);
} elseif (!empty($column['class'])) {
$class = explode("\\", $column['class']);
$label = Inflector::camel2words(end($class));
}
}
return trim(strip_tags(str_replace(['<br>', '<br/>'], ' ', $label)));
}
} This does not allow, for example, a dependency injection because the column is not instantiated before defining the label, for example: \Yii::$container->set('tubaron\grid\DropDownActionColumn', [
'dropdown' => true,
'dropdownOptions' => [
'class' => 'pull-right',
],
'template' => '{view} {update}',
'header' => Yii::t('tubaron', 'Ações'),
]); It may not be a crucial thing, but it might make things more centralized, so it would be great if you had events in DynaGrid like EVENT_BEFORE_INIT, EVENT_AFTER_INIT, etc ... It's a suggestion. Thank you. |
Same too |
@githubjeka would appreciate if you can share details of any issue and what your proposal is to overcome it in this extension, rather than just a critical remark from your end which is of no use or help. @AndersonDan will need to study, understand and look into your proposed suggestion. Thanks for the suggestion. |
Oh, sorry for this. I've got it all mixed up, your code correct. I just thought of something that is not exist... REF yiisoft/yii2#4504 yiisoft/yii2#4738 |
How to set a friendly name for the action column?
The text was updated successfully, but these errors were encountered: