khushal
(Khushal Fadiya)
August 13, 2013, 9:53am
1
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.
khushal
(Khushal Fadiya)
August 13, 2013, 10:11am
3
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 :
array(
'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.
Ankit_Modi
(Ankit Modi)
August 13, 2013, 10:18am
4
try this
'value' => '( $model->date1 == 1 ? " ":"abc")',
khushal
(Khushal Fadiya)
August 13, 2013, 10:21am
5
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.
Ankit_Modi
(Ankit Modi)
August 13, 2013, 10:31am
6
can you post the code so someone help this
khushal
(Khushal Fadiya)
August 13, 2013, 10:34am
7
array(
‘label’=>‘User Date’
‘value’ => $model->date1,
‘visible’ => $model->date1 != NULL,
),
Ankit_Modi
(Ankit Modi)
August 13, 2013, 10:39am
8
Hi,
Also you can use header function
array(
'header'=>'User Date'
'value' => $model->date1,
'visible' => $model->date1 != NULL,
),
khushal
(Khushal Fadiya)
August 13, 2013, 10:49am
9
Hi,
Also you can use header function
array(
'header'=>'User Date'
'value' => $model->date1,
'visible' => $model->date1 != NULL,
),
header is for gridview not for DetailView.
So for detailview it is not working.