• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Spry: click to show details? JQuery?

Engaged ,
Jan 16, 2012 Jan 16, 2012

Copy link to clipboard

Copied

I have an app which displays a spry dataset, like so:

Tomato Picker.jpg

Those cards are a spry region:

<div spry:region="pv1" spry:repeatchildren="pv1" class="badges">

                    <div class="badge">

                              <img src="images/{image}" alt=""/>

                              <div class="details">

                              <p class="name">{name}</p>

                              <p>Color: {color}</p>

                              <hr class="clrflt"/>

                              <p class="desc">{description}</p>

                              <p> Reference: <a href="{refLink}">{refName}</a></p>

                    </div>

          </div>

My question is, I'd like to create another DIV that appears when one of the cards is clicked (or a view details button).  I know how to do the hide and show with JQuery, but how could I get which card was clicked on, so my details DIV shows the correct record's data? Is this doable is Spry alone?  I have had problems getting Spry items to cooperate with JQuery...

TOPICS
Server side applications

Views

1.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 19, 2012 Jan 19, 2012

Copy link to clipboard

Copied

I don't know of the spry property to use (if there is one). In jQuery (Version >= 1.6):

  • assign each div a name
  • $(this).tagName
  • or event.target.tagName

another option would be to bind (http://api.jquery.com/bind/) the data to the div. Now the interesting question here is whether jQuery inside a spry loop get looped with the html content or not.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jan 19, 2012 Jan 19, 2012

Copy link to clipboard

Copied

LATEST

Yes, but in this case all the child divs are created dynamically by Spry, so I can't assign a name.

I have gotten a bit closer with this:

<div spry:region="pv1" spry:repeatchildren="pv1" class="badges">

                    <div class="badge">

                              <img src="images/{image}" alt=""/>

                              <div class="details">

                                        <p class="name" spry:select="selected" spry:setrow="pv1" >{name}</p>

                                        <p>Color: {color}</p>

                                        <hr class="clrflt"/>

                                        <p class="desc">{description}</p>

                                        <p> Reference: <a href="{refLink}">{refName}</a></p>

                              </div>

                    </div>

          </div>

which updates a detail div:

<div id="detail" spry:detailregion="ds1">

          <p class="name">{name}</p>

</div>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines