Cjuiaccordion Keep State With Cookie

Hi everybody,

I implemented CJuiAccordion for my side bar menu. I would like to keep the panel active opened when I refresh page for exemple or when I change it but I don’t get it. I read here : http://www.snyderplace.com/demos/accordion.html that there was a “cookieOptions” which was present but it seems that it doesn’t work… I tried to use this function (find here : http://jaaulde.com/test_bed/stickyaccordion/) too but doesn’t work :


					active: ( $.cookies.get( cookieName ) || 0 ),

					change: function( e, ui )

					{

						$.cookies.set( cookieName, $( this ).find( 'h3' ).index ( ui.newHeader[0] ) );

					}

I use only ‘panels’ and ‘options’, here is my declaration cjuiaccordion options :


        $this->widget('zii.widgets.jui.CJuiAccordion', array(

    'panels'=>array(

    ...

    ),


    'options'=>array(

        'animated'=>'slide',

        'autoHeight'=>false,

        'cookieOptions'=>array('path'=>"/"),

        'cookieName'=>'accordion',

        'collapsible'=>true,

        /*'active'=>'js:($.cookies.get(cookieName) || 0)',

	'change'=>"js:function(e,ui)

					{

						$.cookies.set(cookieName,$( this ).find('h3').index(ui.newHeader[0]) );

					}",*/

    )

    ));

I solved it thanks to this tutorial : http://stackoverflow.com/questions/11231436/jquery-ui-accordion-menu-saving-menu-state-even-after-refresh

hope it could help someone else, however if you have a “less writing” solution, I’m interested =D