2 Replies Latest reply on May 18, 2009 11:43 AM by mattf2007

    Need help with dynamic accordian and link buttons

    mattf2007

      I am able to create the accordian without issue dynamically and even put in the link buttons but I am not able to set a click event for the link button. Can anyone please give me some suggestions as I really need to finish this today?

       

      Here is my code:

       

      function onAdd()
      {
      var c:Canvas = new Canvas()
      var v:VBox = new VBox();
      var l:LinkButton = new LinkButton();
      l.label = "Name";            
      c.label = "A New Category";               
      c.addChild(v);
      c.addChild(l);                
      accordion.addChild(c);         
      }

       

       

      <mx:Panel

       

       

       

      x="0" y="0" width="690" height="276" layout="absolute" >

           <mx:Canvas x="0" y="0" width="670" height="247" id="main_canvas">

                <mccune:HAccordion id="accordion" width="100%" height="100%" backgroundColor="#e5e5e5">

                    </mccune:HAccordion>

           </mx:Canvas>

      </mx:Panel>

       

       

       

      Any help is greatly appreciated.

        • 1. Re: Need help with dynamic accordian and link buttons
          Gregory Lafrance Level 6

          What problems are you having, as in what errors?

          • 2. Re: Need help with dynamic accordian and link buttons
            mattf2007 Level 1

            Actually I have no errors but cannot manage to set a click property for the linkbutton. I have a query returning that contain categories and names belonging to the categories.

             

            for example:

             

            categoryid     parentid     name

            5                    0               Actors

            44                  5               Adam West

             

            So I need to loop over the response looking for the main categories which will be the accordian tabs such as Actors and then populate it with the appropriate actor names. The actor names are then passed as a URL variable to a .net application and displays their information accordingly.  I need to be able to loop the return and set the link button labels and click event so that I can have it call the correct page.

             

            I hope my explanation helps and thanks