how to have two attributes in a columns to display data, and calculate sum of one attribute

how to have two attributes in a columns to display data, and calculate sum of one attribute

anujgakharanujgakhar Posts: 3Questions: 0Answers: 0

I am having two attributes in a single column of a row of a table. i want to calculate sum of one attribute in the footer. I am using data table 1.9. can anyone tell me how to do it
example

my jsp code looks like this

<th>revenue (r.percentage)</th>
<td>${a.revenue} (${a.percentage}%)</td>

<td>${a.revenue} (${a.percentage}%)</td>

page
10,000(20%)
20,000(40%)
..............................
**30,000 **
i want to calculate 30,000 at the footer

Replies

  • rf1234rf1234 Posts: 2,983Questions: 87Answers: 421
  • anujgakharanujgakhar Posts: 3Questions: 0Answers: 0
    edited August 2018

    Thanks for the reply rf1234 but the problem isnt solved with the solution provided, that is a single column of a row contain 2 attributes here for instance i have 2 products a,b
    A B
    <tr>
    <td>${a} ${(aPercentage)}</td> <td>${b} ${(bPercentage)}</td>
    </tr>
    <tr>
    <td>${a} ${(aPercentage)}</td> <td>${b} ${(bPercentage)}</td>
    </tr>
    <tr>
    <td>${a} ${(aPercentage)}</td> <td>${b} ${(bPercentage)}</td>
    </tr>
    <tr>
    <td>${a} ${(aPercentage)}</td> <td>${b} ${(bPercentage)}</td>
    </tr>
    ...................................................................................................................
    sum(a) sum(b)

    sum a doensnt include a percentage
    so how to fetch value of 'a' only as of now it recives 'a(aPercentage)' in my datatable inside data

  • anujgakharanujgakhar Posts: 3Questions: 0Answers: 0

    Thanks for the reply rf1234 but the problem with the solution provided is that single column of a row doesnt contain 2 attributes here for instance i have 2 products a,b
    A B
    <tr><td>${a} ${(aPercentage)}</td> <td>${b} ${(bPercentage)}</td></tr>
    <tr><td>${a} ${(aPercentage)}</td> <td>${b} ${(bPercentage)}</td></tr>
    <tr><td>${a} ${(aPercentage)}</td> <td>${b} ${(bPercentage)}</td></tr>
    <tr><td>${a} ${(aPercentage)}</td> <td>${b} ${(bPercentage)}</td></tr>
    ...................................................................................................................
    sum(a) sum(b)

    sum a doensnt include a percentage
    so how to fetch value of 'a' only as of now it recives 'a(aPercentage)' in my datatable inside data

This discussion has been closed.