I am trying to show a nested accordion,
Below is the finaldata map to be displayed in html:
[
{"Name":"Oil Gas Salt Resources Act 1990","Id":"a1S05000006zhvAEAQ","Question":"a1b05000005DzfzAAC","Type":"Title",
"Sections":[{"Name":"4(1) Obstruction of inspector","Question":"a1b05000005Dzg4AAC","ParentQuestion":"a1b05000005DzfzAAC","Type":"Section","Id":"a1S05000006zhvBEAQ"},
{"Name":"4(3) Refusal to produce records or make examinations","Question":"a1b05000005Dzg0AAC","ParentQuestion":"a1b05000005DzfzAAC","Type":"Section","Id":"a1S05000006zhvDEAQ"}]},
{"Name":"Ontario Regulation 245/97","Id":"a1S05000006zhvHEAQ","Question":"a1b05000005DzgOAAS","Type":"Title",
"Sections":[{"Name":"7 Registration of Works","Question":"a1b05000005Dzg5AAC","ParentQuestion":"a1b05000005DzgOAAS","Type":"Section","Id":"a1S05000006zhvIEAQ"}]},
{"Name":"OGSRA Provincial Operating Standards","Id":"a1S05000006zhvQEAQ","Question":"a1b05000005Dzf2AAC","Type":"Title",
"**Sections**":[{"Name":"2. Injection Permits","Question":"a1b05000005DzgPAAS","ParentQuestion":"a1b05000005Dzf2AAC","Type":"Section","Id":"a1S05000006zhvREAQ",
"**SubSections**":[{"Name":"2.3 Injection well/project construction, operation & maintenance","Question":"a1b05000005Dzh2AAC","ParentQuestion":"a1b05000005DzgPAAS","Type":"Sub-Section","Id":"a1S05000006zhvSEAQ"}]
}]
}
]
if you notice the third row in the above object array, has nested sections:
Section & within it SubSections
Below is the html code:
<template>
<lightning-card title="Checklist Questions">
<lightning-accordion active-section-name="title">
<template for:each={finalData} for:item="title">
<lightning-accordion-section name="title" label={title.Name} key={title.Id}>
<template for:each={title.Sections} for:item="section">
<lightning-accordion-section name={section.Name} label={section.Name} key={section.Id}>
<template lwc:if={section.SubSections}>
<template for:each={section.SubSections} for:item="subsection">
<lightning-accordion-section name={subsection.Name} label={subsection.Name} key={subsection.Id}>
sub data
</lightning-accordion-section>
</template>
</template>
</lightning-accordion-section>
</template>
</lightning-accordion-section>
</template>
</lightning-accordion>
</lightning-card>
</template>
it shows the accordion till "Sections" array, but not the "SubSections", as not every Section has a property "SubSections" , I am checking using If directive in html. When i click the Section level accordion, it does not show the Subsections accordion.
Once click "2. Injection Permits", then section collapses and goes back to parent accordion which is "OGSRA Provincial Operating Standards"
Appreciate your help. Wondering what is wrong with the html code.
