troubleshooting Question

create dynamic accordion in spry....

Avatar of saad220
saad220Flag for Germany asked on
JavaScriptWeb DevelopmentAdobe Dreamweaver
2 Comments1 Solution1012 ViewsLast Modified:
I have the following xml file pattern dataSet.....


<?xml version="1.0" encoding="UTF-8"?>
<tree>
<lists>
<parent_d>AAA</parent_d>
<child_d>AAA1</child_d>
<arName>1</arName>
<arName>2</arName>
<arName>3</arName>
<child_d>AAA2</child_d>
<arName>1</arName>
<arName>2</arName>
<arName>3</arName>
</lists>
<lists>
<parent_d>BBB</parent_d>
<child_d>BBB1</child_d>
<arName>1</arName>
<arName>2</arName>
<arName>3</arName>
<child_d>BBB2</child_d>
<arName>1</arName>
<arName>2</arName>
<arName>3</arName>
</lists>
</root>

And i have the following code in place

<div id="example1Region" spry:region="ds1">
  <div id="Acc1" class="Accordion" tabindex="0">
            <div spry:repeat="ds1" class="AccordionPanel">
                  <div class="AccordionPanelTab">{parent_d}</div>
                  <div class="AccordionPanelContent">{child_d} </div>
            </div>
      </div>
<script type="text/javascript">
var a1 = new Spry.Widget.Accordion("Acc1");
</script>
</div>

the problem for the code is, it is just print out only one {child_d} for each {parent_d}..look the result..

AAA     -------AccordionPanelTab
 AAA2  -------AccordionPanelContent
BBB     -------AccordionPanelTab
 BBB2  -------AccordionPanelContent

but what is i want was...the following result

AAA     -------AccordionPanelTab
 AAA1  -------AccordionPanelContent
   1
   2
   3
 AAA2  -------AccordionPanelContent
    1
    2
    3
BBB     -------AccordionPanelTab
 BBB1  -------AccordionPanelContent
    1
    2
    3
 BBB2  -------AccordionPanelContent
     1
     2
     3

forget about the indent..stuff so what is my problem in my code??? any help...






how could i create spry accordion in the following format...





<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:spry="http://ns.adobe.com/spry">
<head>
 
<style type="text/css">
.Accordion {
	width: 350px;
}
</style>
 
<link href="SpryAssets/SpryAccordion.css" rel="stylesheet" type="text/css" />
 
 
<script language="JavaScript" type="text/javascript" src="SpryAssets/xpath.js"></script>
<script language="JavaScript" type="text/javascript" src="SpryAssets/SpryData.js"></script>
<script language="JavaScript" type="text/javascript" src="SpryAssets/SpryAccordion.js"></script>
 
 
<script type="text/javascript">
 
var ds1 = new Spry.Data.XMLDataSet("product.xml", "tree/lists");
 
 
</script>
<body>
 
</div>
 
<div spry:region="ds1">
  <div id="Acc1" class="Accordion" tabindex="0">
		<div spry:repeat="ds1" class="AccordionPanel">
			<div class="AccordionPanelTab">{parent_d}</div>
			<div class="AccordionPanelContent">{child_d} </div>
		</div>
	</div>
<script type="text/javascript">
var a1 = new Spry.Widget.Accordion("Acc1");
</script>
</div>
 
</body>
</html>
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros