Register an change event from a CJuiAccordion

Does anyone know how to register a state change of the CJuiAccordion widget. I know the widget sends an change event, but how do i program that an action is called from the Controller? I want to do this so that i can present the last state of the accordion after a new page request.

Here’s some Javascript I currently have in a view




jQuery().ready(function(){

  $("#accordion")

    .accordion({ 

          //active: 1, 

          ...

    })

    ...

   .bind("accordionchange", function(event, ui) {

     //jQuery(ui.newHeader).attr('tabindex', '-1');

     //jQuery('<div>' + ui.oldHeader.text() + ' hidden, ' + ui.newHeader.text() + ' shown</div>').appendTo('div #log');

   });

   ...

  // open next accordion view

  n = $("#accordion").accordion("option", "active");

  $("#accordion").accordion("activate", n+1);

});



(not optimized, may be changed later and/or generated from PHP-land)

/Tommy

I think thats better clarified a little, since most people will be using a CJuiAccordion widget:




$(document).ready(function() {

  $("#yw0").bind("accordionchange", function(event, ui) {

		// do stuff, make sure you have the correct ID for the accordion

		}

   });

});



accordion() is not needed and will cause problems.

Thanks for the clarification. It seems like I didn’t use the Zii CJuiAccordion in that project. (Zii was incorporated in the framework core Aug 20 2010).

/Tommy