2 Replies Latest reply: Nov 5, 2009 12:38 AM by Phil_W RSS

    Expand or collapse all collapsible panels at once.

    Phil_W Community Member

      Hi,

       

      I have a page with a number of collapsible panels on it generated from SpryData.

       

      I know the collapsible panel names because their IDs are generated from the Spry data with

       

      <div class="CollapsiblePanel" id="cp{ds_RowNumber}" spry:repeat="Events">

       

      I have a couple of links on the page that I want our members to be able to click to be be able to collapse or expand all collapsible panels at once. How can I return a reference to the collapsible panel objects so I can close / open them using the open / close functions of the widget etc?

       

      See http://www.thehmc.co.uk/Events4.html and the links with the text (Show or hide all event details)

       

      i.e. I have a function and I know Spry.$$ is not what I want , but what do I need to return the object reference?

       

      function dhide()
      {
      var panelCount = Events.getRowCount();
      for (var p = 0;p < panelCount;p++)
      {
        panelID = '#cp' + p;
        var mypanel = Spry.$$(panelID);
        var a = panelID.close();
       
       
      }

      }

       

      Thanks

       

      Phiol