I have a table in which there are customer names, as well as the products that they purchased with their prices. Thus, for each client there are several records. This table is simple in table 3 columns: name, product and price.
What I want to do:
Put all the records belonging to one customer together (I did this), and immediately after these lines add one new additional line, which will simply show the total value of all products purchased by each customer. This row will contain an empty cell in the name and column of the product. And it will have a final value in the price column.
EDIT
This is a simple simple table without any class or identifiers. grouped by customer table generated by php. So I have a table like this
<table> <tr> <td> name1 </td> <td> product1 </td> <td> 100 </td> </tr> <tr> <td> name1 </td> <td> product2 </td> <td> 200 </td> </tr> <tr> <td> name2 </td> <td> product3 </td> <td> 50 </td> </tr> <tr> <td> name2 </td> <td> product1 </td> <td> 100 </td> </tr> </table>
And I want to convert this to:
<table> <tr> <td> name1 </td> <td> product1 </td> <td> 100 </td> </tr> <tr> <td> name1 </td> <td> product2 </td> <td> 200 </td> </tr> <tr> <td> </td> <td> </td> <td> 300 </td> </tr> <tr> <td> name2 </td> <td> product3 </td> <td> 50 </td> </tr> <tr> <td> name2 </td> <td> product1 </td> <td> 100 </td> </tr> <tr> <td> </td> <td> </td> <td> 150 </td> </tr> </table>
jquery html-table row
understack
source share