EFgMenu is a yii widget wrapping fgmenu.
It provides context, horizontal, vertical and 2 kind of ipod-style menus.
(remark: i had to fix/enhance the original fgmenu js codes a bit)
History ¶
- 1.1
- added linking of jquery-ui.css
- provided a demo
- 1.0
- base version
Requirements ¶
Yii 1.x
Usage ¶
Download the demo from here and check the project page for example codes.
example within view
Hi,
I try to implement your menu inside a _view item, but it doesn't work :( In the first item, it isn't even rendered and then in the following items, it doesn't build the "menu" and only returns the html list...
Would be great to have an working example!
Regards Philipp
for Philip
Hello,
check 1.1 for a working demo.
I'm not sure what does it essentially mean that "using from a _view item" since UI elements are generally placed on some view file, in the controller's /view directory. If you have still problem, i suggest you to check and play with the 4th parameter (boolean) of CClientScript::renderPartial() method if you use that for rendering the view.
Regards, nlac
mistyping
sorry: CController::renderPartial() instead of CCLientScript::renderPartial()
view
Hi Nlac,
the issue is, that I don't use the renderPartial function... I just use the CController::render() and then the view looks like this:
<h1><?php echo GxHtml::encode(TaVariante::label(2)); ?></h1> <?php $this->widget('zii.widgets.CListView', array( 'dataProvider'=>$dataProvider, 'itemView'=>'_view', ));
And inside the _view:
<?php $items = array( array('label'=>'Home', 'url'=>array('/site/index')), array('label'=>'About', 'url'=>array('/site/page', 'view'=>'about')), array('label'=>'Products', 'url'=>'#', 'items'=>array( array('label'=>'Web', 'url'=>'#', 'items'=>array( array('label'=>'NLSClientScript', 'url'=>array('/site/page', 'view'=>'nlsclientscript')), array('label'=>'EFgMenu', 'url'=>array('/site/page', 'view'=>'efgmenu')), array('label'=>'XCruder', 'url'=>'#') )), )) ); $this->widget('ext.efgmenu.EFgMenu',array( 'bDev'=>true, 'id'=>'simpleMenu'.$data->idta_variante, 'trigger'=>'#bSimple'.$data->idta_variante, 'items'=>$items, 'menuOptions' => array( 'flyOut'=>true ) )); ?>
I checked your files, and I didn't see an renderPartial in there...
thank you for your support! Cheers Philipp
markup
ok, i guess you missed to prepare the html markup for the trigger button. The extension doesn't create it, you need to have it on the view - i'll extend the documentation on the home page cus it is not obvious indeed.
So place a html like that befor the menu widget:
<button id="bSimple" class="ui-widget ui-state-default ui-corner-all ui-button ui-button-text-only" title="click me!"> <span href="#" class="ui-button-text">Press me</span> </button>
Yes, that solved it
Hi nlac,
thanks for the hint! This one solved it, and yes, pls update your documentation, as it wasn't described in there;)!
It works great now!
Thank you!!!
Cheers Phil
again ajax update problem
Hi, after it works on the first page of the CListView... when I use pagination, it's broken...
I implemented it like this:
1) The view, rendered by the actionIndex()
<?php $this->renderPartial('/taPerioden/_m_view', array('dataProvider'=>$dataProvider),false,true); ?>
2) the view rendered by renderPartial, as there is no other way to pass parameter for client scripts...
<?php $this->widget('zii.widgets.CListView', array( 'dataProvider'=>$dataProvider, 'itemView'=>'_view', 'template'=>'{items}\n{pager}', )); ?>
3) last but not least, the item himself...
<div class="viewnarrow" style="background-color: #<?php echo $data->per_intern>10000?'abcdef':'ffffff'; ?>"> <table class="nobottommargin"> <tr> <td style="width: 50px;"> <?php echo GxHtml::encode($data->per_intern); ?> </td> <td style="width: 80px;"> <b><?php echo GxHtml::encode($data->per_extern); ?></b> </td> <td style="width: 80px;"> <?php echo GxHtml::encode($data->getAttributeLabel('per_intern_year')); ?>: <b><?php echo GxHtml::encode($data->per_intern_year); ?></b> </td> <td style="width: 80px;"> <?php echo GxHtml::encode($data->getAttributeLabel('per_intern_quater')); ?>: <?php echo GxHtml::encode($data->per_intern_quater); ?> </td> <td style="width: 80px;"> <?php echo GxHtml::encode($data->getAttributeLabel('per_intern_month')); ?>: <?php echo GxHtml::encode($data->per_intern_month); ?> </td> <td> <?php echo GxHtml::encode($data->getAttributeLabel('per_intern_week')); ?>: <?php echo GxHtml::encode($data->per_intern_week); ?> </td> <td style="vertical-align: top;width: 50px"> <button id="bSimple<?php echo GxHtml::encode($data->idta_perioden); ?>" class="ui-widget ui-state-default ui-corner-all ui-button ui-button-text-only" title="actions"> <span href="#" class="ui-button-text">actions</span> </button> </td> </tr> </table> <?php $items = array( array('label'=>Yii::t('menu','view'), 'url'=>array('view', 'id' => $data->idta_perioden)), array('label'=>Yii::t('menu','edit'), 'url'=>array('update', 'id' => $data->idta_perioden)), ); $this->widget('ext.efgmenu.EFgMenu',array( 'bDev'=>true, 'id'=>'simpleMenu'.$data->idta_perioden, 'trigger'=>'#bSimple'.$data->idta_perioden, 'items'=>$items, 'menuOptions' => array( 'flyOut'=>true ) )); ?> </div>
thank you and hope you have a solution...
Cheers Philipp
pagination
Install NLSClientscript, i highly recommend it if you use ajax updates with widgets.
If it doesn't help, set the ajaxUpdate attribute of your widget uses pagination to FALSE in order to use normal page request.
Otherwise dig into fgmenu - remember i just extended it a bit and wrapped it for Yii.
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.