Solved

How to create multiple accordions using jquery base on records in arrayList

Posted on 2014-01-20
2
412 Views
Last Modified: 2014-01-24
Hi, I have a requirement to dynamically create accordions using jquery, based on how many records are returned in my array List from my backing bean. So, for each record returned, a new accordion needs to be created on my jsp page. I would attach some code but unfortunately don't have an idea how to start. I would like to know, is this even possible? If anyone could point me to some articles or code snippets, or even some general advice, it would be greatly appreciated.

Thanks!
0
Comment
Question by:grnmachine
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 39795871
Basically the idea :
var accordeonList = [];
$.each(arrayList, function(index,value) {
      var accordeon = [];
      $.each($("records", value), function(i,v) {
           var newAccordeonItem = "<-- your design -->";           
           accordeon.push(newAccordeonItem);
      });
      accordeonList.push(accordeon);
});

Open in new window

0
 
LVL 86

Expert Comment

by:CEHJ
ID: 39796597
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

PROBLEM: The other day I was working on adding an ajax request to a webpage that already had a dialog box on the page.  The dialog box was using relative positioning to be positioned next to a form field I had on the page.  Everything was working…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

635 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question