Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7021317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:26:02+00:00 2026-05-27T23:26:02+00:00

I have a view that creates a sub-view per item in the list. Generically

  • 0

I have a view that creates a sub-view per item in the list. Generically let’s call them ListView and ListItemView. I have attached an event as follows on ListItemView:

events: {
    "click .remove": "removeItem"
}

I have template-generated html for ListItemView that is approximately like the following (swapped lb/rb for {/} so you can see the “illegal” html):

{div class="entry" data-id="this_list_item_id"}
SOME STUFF HERE
{div class="meta"}
{a class="remove" href="javascript:;"}[x]{/a}
{/div}
{/div}

The problem is, when the click on any of the [x]’s, ALL of the ListItemViews trigger their removeItem function. If I have it go off of this model’s id, then I drop all the items on the page. If I have it go off the clicked item’s parent’s parent element to grab the data-id, I get a delete for EACH ListItemView instance. Is there a way to create an instance-specific event that would only trigger a single removeItem?

If I have ListView hold a single instance of ListItemView and reassign the ListItem model and render for each item in the list it works. I only end up with one action (removeItem) being triggered. The problem is, I have to find the click target’s parent’s parent to find the data-id attr. Personally, I think the below snippet is rather ugly and want a better way.

var that = $($(el.target).parent()).parent();

Any help anyone gives will be greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T23:26:03+00:00Added an answer on May 27, 2026 at 11:26 pm

    It seems like your events hash is on your ListView.

    If it is, then you can move the events hash to ListItemView and your removeItem function can be the following

    removeItem: function() {
      this.model.collection.remove(this.model);
    }
    

    If this isn’t the case, can you provide your ListView and ListItemView code so I can look at it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In a word, how? I have a view controller that creates a few custom
I have a for loop that creates multiple UIImageViews that I add to self.view
I have created a list view that displays the names and dates of items
We have created a new List View Style that shows thumbnails from a picture
I have a view that has a list of jobs in it, with data
I would like to have a special sub-node that could be attached to other
If i have a controller action Create that returns a view with the following
if i have created a view model and have a partial form that is
I have a view that I want to add some custom drawing to. I
I have a View that can vary significantly, depending on the 'mode' a particular

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.