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 9221325
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T03:33:19+00:00 2026-06-18T03:33:19+00:00

i have a backbone view like this: var newrow=Backbone.View.extend({ el:<table>, events:{ ‘click .edit’:’editrow’, ‘click

  • 0

i have a backbone view like this:

var newrow=Backbone.View.extend({

        el:"<table>",
        events:{
            'click .edit':'editrow',
            'click .delete':'deleterow'
            },


            render: function()
            {
                data=this.model.toJSON();
                $('table').dataTable().fnAddData([data.name,data.email,data.contact_number,'<span class="edit">Edit</span><span class="delete">Delete</span>']);
                return this;
            },

            editrow:function(){
                alert ("edit);
            },

            deleterow:function(){
            alert("delete");
            }
        })

I need to attach click events with td having spans with class ‘edit’. I know this will not work because i am adding rows dynamically using datatable function. I am trying to add rows in a pre-rendered datatable. What may be the solution.

P.S I have already rendered a empty table in some other view. This works fine and datatable gets rows added. But can’t figure out how to add click events in elements.

  • 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-06-18T03:33:20+00:00Added an answer on June 18, 2026 at 3:33 am

    Few things are a bit off in your view. If you fix those, it might work.

    • Instead of el:"<table>" try tagName:"table". This is the correct way to set up a new element for a view.

    • Instead of $('table').dataTable(). try this.$el.dataTable(). The former performs a selection for all table elements in you page, and the latter references your view´s (<table>) element.

    As long as the elements you add are within the view’s el the events should wire up automatically. If it doesn’t work for some reason, try calling this.delegateEvents() after inserting new rows.

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

Sidebar

Related Questions

I have a view and collection like this: window.DmnView = Backbone.View.extend({ template: _.template($(#tmpl_dmnListItem).html()), events:
I have html content like: <button class=submit>Save</button> and view like: var MyView = Backbone.View.extend({
I have a backbone fetch view method that does this: var ResultsView = Backbone.View.extend({
I have the view class FoursquareSearch.Views.Origin extends Backbone.View events: 'change [name=origin]': 'setOrigin' 'click [name=geolocate]'
I have the following code: var GoalPanelView = Backbone.View.extend({ // Bind to the goal
I have a view that takes a collection like below: MyView = Backbone.View.extend({ initialize:
I have following setup in my Backbone View: var SomeView; SomeView = Backbone.View.extend({ initialize:
So I have a View that looks like this. //base class var SelectListView =
I have a standard list view setup with backbone that looks something like below.
I have a View (created using Backbone.View.extend) and a JSON object, I actually get

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.