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

  • SEARCH
  • Home
  • 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 8256207
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T01:47:06+00:00 2026-06-08T01:47:06+00:00

my table columns are amount, price, value, date, notes addCommas and round are formatting

  • 0

my table columns are amount, price, value, date, notes

addCommas and round are formatting functions

the json data looks like this

[{"amount":"19905405",
  "price":"3.7",
  "value":"736500",
  "date":"2012-02-29", 
  "notes":""
},
{"amount":"10000000",
 "price":"2",
 "value":"200000",
 "date":"2011-12-05",
 "notes":"test one only"
 }]

inside the $.ajax({... success:function(store){... this is my javascript loop to draw the table

$("#table_a").empty();

var table = '<tbody><tr><td style="ba.....rest of header row string';
$.each(store, function(row, i) {
   table += '<tr>';
   table += '<td><span>' + addCommas(round(i/1000000,2)) + "m" + '</span></td>';
   table += '<td><span>' + i + '</span></td>';
   table += '<td><span>' + "$" + addCommas(round(i/1000000,2)) + "m" + '</span></td>';
   table += '<td><span>' + i + '</span></td>';
   table += '<td><span>' + i + '</span></td>';
   table += '</tr>';
});
table += '</tr></tbody>';
$("#table_a").append(table);

the end result currently looks like this

enter image description here

how do I get the loop right to add formatting to the cell data ?

  • 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-08T01:47:09+00:00Added an answer on June 8, 2026 at 1:47 am

    got it…

    $("#table_a").empty();
    
    var table = '<tbody><tr><td style="ba.....rest of header row string';
    $.each(store, function(i, data) {
       table += '<tr>';
       table += '<td><span>' + addCommas(round(store[i].amount/1000000,2)) + "m" + '</span></td>';
       table += '<td><span>' + store[i].price + '</span></td>';
       table += '<td><span>' + "$" + addCommas(round(store[i].value/1000000,2)) + "m" + '</span></td>';
       table += '<td><span>' + store[i].date + '</span></td>';          
       table += '<td><span>' + store[i].notes + '</span></td>';
       table += '</tr>';
    });
    table += '</tr></tbody>';
    $("#table_a").append(table);
    

    thanks Phil Jackson

    https://stackoverflow.com/a/2529958/1185018

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

Sidebar

Related Questions

I have a table of data something like this. date, amount, price 2009-10-12, 20,
I have a Sales table, with the following columns: employeeID amount date Now I
I have a table with columns like these : idx | amount | usercol1
I have a table called credit_log and the columns are user_id | amount The
The table columns have the data type BLOB and CLOB. What are the corresponding
I want to get table metadata for all table columns. Like type string(varchar2)/int/float/datetime and
I want to get value of <asp:TextBox ID=txtTotalAmount CssClass=classTotalAmount number Columns=8 runat=server></asp:TextBox> from table.
<table id=myTable style=width: 650px;> <tbody> <tr style=font-weight: bold;> <td>Name</td> <td>Price</td> <td>Supplier</td> <td>Amount</td> <td>Basket</td> </tr>
I have an HTML table with 3 columns and amount of text in each
I am creating a self-related table: Table Item columns: ItemId int - PK; Amount

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.