saiful
(Ipulxd)
August 26, 2010, 6:27am
1
Hi,
I’ve problem with hideEmptyItems property of CMenu. Whether I set it true or false, it will always show the menu.
here’s my code:
$this->widget('zii.widgets.CMenu', array(
'items'=>array(
array(
'label'=>'User',
'url'=>array('/user/index'),
'items'=>array(
array(
'label'=>'User List',
'url'=>array('/user/index'),
'visible'=>false,
),
),
),
),
'hideEmptyItems'=>true,
));
can anyone give me a clue?
mdomba
(Maurizio Domba Cerin)
August 26, 2010, 6:43am
2
And what is the display you get?
You see only the User item or you get them both?
So you have a menu "User" with a submenu "User List"
Because you set the “User list” as not visible… the result of your code will be the display of only “User” without it’s submenu.
saiful
(Ipulxd)
August 26, 2010, 6:52am
3
mdomba:
And what is the display you get?
You see only the User item or you get them both?
So you have a menu "User" with a submenu "User List"
Because you set the “User list” as not visible… the result of your code will be the display of only “User” without it’s submenu.
I get User item shown.
in the API is says
whether to hide empty menu items. An empty menu item is one whose ‘url’ option is not set and which doesn’t contain visible child menu items. Defaults to true.
when i commented url on User item
$this->widget('zii.widgets.CMenu', array(
'items'=>array(
array(
'label'=>'User',
//'url'=>array('/user/index'),
'items'=>array(
array(
'label'=>'User List',
'url'=>array('/user/index'),
'visible'=>false,
),
),
),
),
'hideEmptyItems'=>true,
));
now User menu fulfill condition ‘url not set’ and ‘does not contain visible child items’ so User menu should be invisible. but in my case it still remain visible.
thanks…