1

I have a Twitter Bootstrap accordion data-toggle binded to a list, in my visualforce page. On page load, the list will be in collapsed state by default. When the user expands it and performs any command action, then the page block will be rerendered.

Now whenever the pageblock is rerendered, the expanded list node is getting collapsed just like its initial state. Now I am struggling to preserve the datatoggle state on postback.

Could someone please suggest a way on how to preserve the data-toggle state?

Please Note: I am using dynamic ID for the target div element.

Visualforce code:

<apex:repeat var="lst" value="{!DetailsList}" >
<li> <div id="accordion"> <a hef="#" class="accordion-toggle collapsed" data-target="#{!lst.Name}" data-toggle="collapse"> <label class="tree-toggler nav-header">&nbsp; <b>{!lst.Name}</b> </a>
 <div id="{!lst.Name}" class="panel-collapse collapse">
<li>FirstName</li>
<li>LastName</li>
</div>
</div></li>
</apex:repeat>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.