Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

Type "not used" in EditableColumn #97

Open
Bhoft opened this issue Mar 3, 2014 · 0 comments
Open

Type "not used" in EditableColumn #97

Bhoft opened this issue Mar 3, 2014 · 0 comments

Comments

@Bhoft
Copy link
Contributor

Bhoft commented Mar 3, 2014

Is there some requirement why the EditableColumn doesn't use the "type" setting for e.g. formating some gridcolumn with 'type'=>'boolean' or some manual format?

I tried my own format setting e.g. type 'percentage' which isn't shown.

I looked into the code an saw that you call the parent::renderDataCellContent($row, $data); function only if you set 'value' of the column or if the you don't render a model.
And therefore the 'type' isn't used at all for model attribute data columns.

Why didn't you just call the renderDataCellContent every time and add something like this to your code:

$options['htmlOptions']['data-value'] = $data->getAttribute(empty($this->editable['attribute']) ? $this->name : $this->editable['attribute']);

This will always set the 'data-value' with the correct 'attribute' value in your link. Then you could use the 'type' CDataColumn rendering like in normal grids but still have the correct (not changed) value for your Editable Popup for editiing.

After 'success' you normally refresh the grid anyway and therefore get a correct formated output again or you have to do the formated output in javascript.

Ok in my case i also could set
'value' => 'CHtml::encode($data->vat_percentage."%")',
and set the following in the editable parameters
'htmlOptions' => array(
'data-value' => '$data->vat_percentage'
)
To get the same result but a simple 'type' => 'percentage' would be easier to code.

This is just a Idea.
Regards Horizons

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants