CDataColumn: Getting data from other column without model

Hi there,

I was using my own function for generating contents of CDataColumn, using data from another column, like this:

'value'=>'CFR::generateStatusImageAndText($data->STAT, $data->OINFO)',

This worked fine, when CGridView was fed with CActiveDataProvider, but - what is obvious - fails to work, when I switched it to CSqlDataProvider.

So question: Is there any way to get data from another column when using CGridView in non-model version (without CActiveDataProvider)?



Hey Trej

use something like

'select as u_name,

user.password as u_password,


and then in the grid use the columns like





in your case more like




	'value'=>'CFR::generateStatusImageAndText($data->u_name, $data->u_password]'

  ) ,


but if you want to use a filter it needs to be done using a model, there is a post where I was talking about it so I learnt how to do it using dbCriteria

Hey Gustavo,

I fear that your solution will not change anything.

I forgot to wrote, that I’m gettting error "Trying to get property of non-object", and it corresponds to the line, where I’m calling my function:

'value'=>'CFR::generateStatusImageAndText($data->STAT, $data->OINFO)',

In your solution, you are using the same function, so I assume (can’t test it right now) that I will get the same results - i.e. the same error.

try to use


as it is an array