Cdetailview Column

Hello Everyone!!

I have used CDetailView for displaying particular record.

In DB I have one column as date and that column can have null value.

So in CDetailView it is displaying that column as "NOT SET", but I want that if value is null for any record at that time this column should not be visible to user.

Thanks in advance!!!

Since v1.1.15, attributes in CDetailView have a visible flag. That should help.

I want to make it vivible based on the condition. If value is present in DB at that time it should display that value.

I make a code like this :


	    'value' => $model->date1,

	    'visible' =>  $model->date1 != NULL,


It is working fine but if value is present at that time not displaying header for that row.

try this

'value' => '( $model->date1 == 1 ? " ":"abc")',

Thanks everyone!!!

now it is working fine…

just use label for row heading.

The condition that i have put is absolutely correct.

In future you can use this. :rolleyes:

can you post the code so someone help this


‘label’=>‘User Date’

‘value’ => $model->date1,

‘visible’ => $model->date1 != NULL,



Also you can use header function


'header'=>'User Date'

'value' => $model->date1,

'visible' => $model->date1 != NULL,


header is for gridview not for DetailView.

So for detailview it is not working.

cool… :rolleyes:

i got it…