I am trying to do a partial refresh on my accordion control (from extension library). I have tried two approaches with no success.
Problem 1: I tried to put the accordion control inside a panel and tried to refresh the panel, however, this results in dojo error:
"Tried to register the widget with id==view:_id1:myaccordion but that id is already registered"
Problem 2: I tried to directly refresh the accordion by its id but then the accordion is broken. I can not destroy the accordion control as recommended on this link (http://www.mydominolab.com/2010/07/dijitdialog-inside-partial-refreshing.html) since it has many other issues and the link specifically deals with dialog control which is quite different from accordion.
Can you please suggest me something? Basically the accordion pane here displays the number of documents and I would like to do a timely refresh to update the count. Any help would really be appreciated.
Edit 1: Just adding a sample code for reference(This code would result in the problem 2 mentioned above and if surrounded by a panel and refreshed by panel id then problem 1 would arise):
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core"
xmlns:xe="http://www.ibm.com/xsp/coreex">
<xp:button value="Refresh" id="button1">
<xp:eventHandler event="onclick" submit="true"
refreshMode="partial" refreshId="accordion1">
</xp:eventHandler></xp:button>
<xp:br></xp:br>
<xp:br></xp:br>
<xe:accordion id="accordion1">
<xe:this.treeNodes>
<xe:basicContainerNode label="Accordion 1">
<xe:this.children>
<xe:basicLeafNode label="Category x"></xe:basicLeafNode>
</xe:this.children>
</xe:basicContainerNode>
<xe:basicContainerNode label="Accordion 2">
<xe:this.children>
<xe:basicLeafNode label="Category y"></xe:basicLeafNode>
</xe:this.children>
</xe:basicContainerNode>
</xe:this.treeNodes></xe:accordion>
</xp:view>
Edit 2: The above code does work when added a panel around it. It was my mistake to post it without testing that. However, I figured out that actual problem was Dojo layout which I am trying to use for the left navigation. Here is the sample code which breaks the accordion.
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core"
xmlns:xc="http://www.ibm.com/xsp/custom"
pageTitle="S4EP TEAMGROUND"
xmlns:xe="http://www.ibm.com/xsp/coreex">
<xp:button value="Refresh" id="button1">
<xp:eventHandler event="onclick" submit="true" refreshMode="partial" refreshId="myPanel">
</xp:eventHandler></xp:button>
<xp:div id="body" dojoType="dijit.layout.BorderContainer"
style="height:100%;width:100%;align:center;">
<xp:this.dojoAttributes>
<xp:dojoAttribute name="persist" value="false"></xp:dojoAttribute>
<xp:dojoAttribute name="gutters" value="false"></xp:dojoAttribute>
</xp:this.dojoAttributes>
<xp:div id="left" dojoType="dijit.layout.ContentPane"
style="width:220px;height:50%">
<xp:this.dojoAttributes>
<xp:dojoAttribute name="region" value="left"></xp:dojoAttribute>
<xp:dojoAttribute name="splitter" value="true"></xp:dojoAttribute>
</xp:this.dojoAttributes>
<xp:panel id="myPanel">
<xe:accordion id="accordion1">
<xe:this.treeNodes>
<xe:basicContainerNode label="Accordion 1">
<xe:this.children>
<xe:basicLeafNode label="Category x"></xe:basicLeafNode>
</xe:this.children></xe:basicContainerNode>
<xe:basicContainerNode label="Accordion 2">
<xe:this.children>
<xe:basicLeafNode label="Category y"></xe:basicLeafNode>
</xe:this.children></xe:basicContainerNode>
</xe:this.treeNodes></xe:accordion>
</xp:panel>
</xp:div>
</xp:div>
</xp:view>
dojoForm="true"
to your XPage where your use the accordion, it will break if you refresh it partial also in your working example.. so it has to do something with the classes loaded or how they get handled when this option is selected. - Michael Saiz