How to spry addEventListener?

Ask a Question related to Macromedia Exchange Dreamweaver Extensions, Design and Development.

  1. #1

    Default How to spry addEventListener?

    How can I display all the items when selecting a category (menu)?

    At the moment is showing only the first item from the dsData set. in the <div
    spry:detailregion="dsData"> when selecting from <div
    spry:region="dsCategory">{category}</div>.

    My goal is to display all the items by category when I click on the <div
    spry:region="dsCategory">{category}</div>




    // I have a product xml file.

    <items>
    <item type="math">
    <category>Math</category>
    <subject>Division</subject>
    <grade type="math">Grade 6 - 8</grade>
    <image>images/math_icon.png</image>
    </item>

    <item type="math">
    <category>Math</category>
    <subject>Multiplication</subject>
    <grade type="math">Grade 4</grade>
    <image>images/math_icon.png</image>
    </item>

    <item type="math">
    <category>Math</category>
    <subject>Addition</subject>
    <grade type="math">Grade 3</grade>
    <image>images/math_icon.png</image>
    </item>

    <item type="science">
    <category>Science</category>
    <subject>Life Science</subject>
    <grade type="science">Grade 6 - 8</grade>
    <image>images/science_icon.png</image>
    </item>
    ...
    </items>


    <script type="text/javascript">
    // I used this to get tall the data:
    var dsData = new Spry.Data.XMLDataSet("included/products.xml", "items/item");

    // I used this to get the categories:
    // Used distinct category
    var dsCategory = new
    Spry.Data.XMLDataSet("included/products.xml","items/item/category",{distinctOnLo
    ad: true, distinctFieldsOnLoad:['category']});
    </script>

    // Display the categories:
    // Using onClick event to set the current row
    <div spry:region="dsCategory">
    <ul id="MenuBar1" class="MenuBarVertical">
    <li id="selecteCat"
    onclick="dsData.setCurrentRow('{ds_RowID}');"
    spry:repeat="dsCategory"><span>{category}</span></li>
    </ul>
    </div>

    // Display the selected items base on the category selection:
    <div spry:detailregion="dsData">
    {category}
    {subject}
    {grade}
    <img src="{image}" border="0" />
    </div>


    Do I need to create and Event Listener to do this?
    Or there is any other way to pass the value onClick event to the data and
    display it by category???

    ~Cheers

    miarte Guest

  2. Similar Questions and Discussions

    1. Where is Spry ZIP???
      Working from the spry help area, and following the steps... 1. Download and unzip the Spry ZIP file from the Adobe Labs website to your hard...
    2. Spry Bar Help
      Alright guys I am kind of a newbie when it comes to dreamweaver (I was always a fan of golive because of its simplicity). Anyways I am running...
    3. Combine Spry Tabbed Panel and Spry HTML Panel
      I would like to maintain the presentation of the tabbed panel and utilize its ability to load content from a Spry Dataset, but I would also like to...
    4. sending arguments to addEventListener
      I'm trying to create a wizard based application. I'm having trouble sending arguments to my "back" and "next" buttons using addEventListener. ...
    5. Button and addEventListener
      Okay, It looks to me like I need to lie to flash to make this work. Can someone confirm that I am not being incredibly stupid here: Scenario...
  3. #2

    Default Re: How to spry addEventListener?

    miarte wrote:
    > Do I need to create and Event Listener to do this?
    > Or there is any other way to pass the value onClick event to the data and
    > display it by category???
    Try asking your question in the Spry forum where you'll get a more focused group of viewers for your question :
    [url]http://www.adobe.com/cfusion/webforums/forum/categories.cfm?forumid=72&catid=602[/url]


    --
    Danilo Celic
    | [url]http://blog.extensioneering.com/[/url]
    | WebAssist Extensioneer
    | Adobe Community Expert
    danilocelic AdobeCommunityExpert Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139