Dynamically populating a JQuery Mobile panel
Hi,
My page uses dynamically created collapsible divs based on a Category Name. The collapsible content inside the div is a 'listview' that
I populate. I need to use a dynamically updated panel, however, I do not know how to pass a variable to the panel.
The variable could be either a string or the 'listview' item itself which I could retrieve the string from the listview
item's text.
The variable will be used to update the panel information. I simply need to get the "value.name" from the active listview's
anchor and pass it to a function that populates the panel.
The code follows:
list.js
- // Get all business objects that match the criteria.
- $.each(getBusinessObjects(businesses[0], "type", categoryName), function(index, value) {
- $("#" + categoryName + "_list")
- .append("<li><a href='#infopanel' data-role='button'>" + value.name + "</a></li>");
- });
- ...
- /* Add dynamic content to infopanel panel.
- */
- function updateInfoPanel() {
- // Code to populate the panel by adding html to the infopanel id elements.
- // I Need to retrieve the 'value.name' text from the sending anchor.
- }
business.html
- ...
- <div id="infopanel" data-role="panel" data-position="right" data-display="overlay" data-theme="e" style="padding:5dp;">
- <!-- panel content goes here -->
- <h3 id="panel_heading"></h3>
- <p id="panel_description"></p>
- <a href="#business_list_page" data-rel="close">Close panel</a>
- </div>
- ...
I am hoping there is a way to simply retrieve 'value.name' from a click on the anchor to pass to the panel's update function.
Thanks in advance for any help!