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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:31:14+00:00 2026-06-17T19:31:14+00:00

I am developing a application in which one of my template renders a table

  • 0

I am developing a application in which one of my template renders a table with n number of rows. Now in each row, i have a column with buttons like edit and delete.

When clicked on edit, a edit form appears in the same window in some div. That form needs to be populated with values fetched from backend.

Now nothing great in this.
My problem is this:

I have a view which renders the complete table using the following template structure:

<script type="text/template" id="ledgersing"> 

 <div class="span6 widget"> 
 <div class="widget-header"> 
 <span class="title">Ledgers</span> 
<button class="btn btn-danger pull-right" id="addLedgerButton">Add Ledger</button> 
</div> 

 <div class="widget-content"> 

 <table width="100%" class="table table-striped dataTable"> 
 <thead> 
 <tr><th>Name</th><th>Email</th><th>Phone</th><th>Action</th></tr> 
 </thead> 
<tbody> 
<% _.each(ledgers,function(data){ %>
<tr>
    <td><%= data.name %></td>
    <td><%= data.email %></td>
    <td><%= data.contact_number %></td>
    <td><span onClick="alert(<%= data.id %>)">x</span></td>
</tr>
<% }) %>
</tbody>

</table> 
</div> 

 </div> 


 </div >
 </script>

In this it just alerts a id when clicked on x. Now do i need to necessarily use onClick event like this? I mean that i will need the id in whatever construct i use for processing. What can be a better solution? I know backbonejs can handle this mess with ease if application is structured properly.
So essentially i want to know from experts, what will they do in such a scenario. How will they structure the application? I am novice to this frontend framework.

  • 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-17T19:31:15+00:00Added an answer on June 17, 2026 at 7:31 pm

    Instead of using _.each in your templates, I’d go with one view per table row as each one has some bit of complexity (edit, delete)

    In these view, you use the events hash to register your DOM events. Never use onclick in your HTML, this is a really bad practice.

    Don’t hesitate to look at the TodoMVC Backbone example for ideas on how to organize your app.

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

Sidebar

Related Questions

Hai every one I am developing an windows application in which i have to
I am developing one application which need the following functionalities I have webserver. I
I have been developing Android application which has 3 ListView and one ContextMenu for
I'm developing an application via which one can send sms by directing it to
I am developing one application which include the email sending functionality (which is like
Hello i am new in android and i am developing one application in which
We are developing an application which is read heavy and could possibly have millions
I am developing an application, in which one of the screen i am using
I'm developing an application which will have these classes: class Shortcut { public string
I am developing an application which has minimum one tchart with 4 fastlines in

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.