Sum column where there's a discount inside

Sum column where there's a discount inside

itajackassitajackass Posts: 162Questions: 48Answers: 3

I'd like to sum column to get total in footer, but in my case i've to show original price and discount price inside same cell:

<td data-price="100"><p style="text-decoration:line-through;color:red;"><small>150</small></p>100</td>

How can get it working only for price discount?

http://live.datatables.net/sadipaji/610/edit

Replies

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Hi @itajackass ,

    Here's one way of doing it, splitting on the '>', there may be a more elegant way with jQuery but this works :)

                  el = b.split('>');
                  return intVal(a) + intVal(el[el.length-1]);
    

    Cheers,

    Colin

  • itajackassitajackass Posts: 162Questions: 48Answers: 3

    HI thanks for the reply... is there a more elegant system like get value directly from, in my example, data-price of td cell instead content of cell?

This discussion has been closed.