How To Open All Toggle Panels with jQuery

How to open all rich faces toggle panels on the page with jQuery:

JSF Code:

<h:panelGroup id="pGSwitchPanelsOn">
	<a4j:commandLink id="a4jcLSwitchPanelsOn" styleClass="yourStyleClass"
		oncomplete="openPanels(event);" accesskey="A" ajaxSingle="true"
		bypassUpdates="true" immediate="true">
		<h:outputText id="oTSwitchPanelsOn" value="Open All Panels" />
	</a4j:commandLink>
</h:panelGroup>

Javascript:

function openPanels(event) {

	// toogle panel list
	jQuery('[id*="simpleTogglePanel_"]').not('[id$="_header"]').not('[id$="_switch_on"]').not('[id$="_switch_off"]').not('[id$="_body"]').each(
			function (i) {
				idpanel = this.id;
				if(SimpleTogglePanelManager.panels.get(idpanel).status == "false")
				{
					jQuery('[id$="' + idpanel + '_header"]').click();
				}
        	});
}

Requirement Engineering, Business Analysis, Agile, Analysis and Design with UML, Java/J2EE, Liferay, Javascript, Embedded C++, MDD, Executable UML, Project Management


© 2017 JULIUSURBAN.NET