columns for quantity, price, subtotal

columns for quantity, price, subtotal

boudgaboudga Posts: 19Questions: 4Answers: 0

How would I add columns to my existing datatables data coming from the database that would be for me to input quantity, price, and when i added those two would reflect a subtotal in the third column?

I am kind of wanting to make a table based invoice of sorts

Answers

  • allanallan Posts: 63,516Questions: 1Answers: 10,473 Site admin

    Editor will let you input the data, and then use a renderer to calculate the third data point from the other two.

    Allan

  • boudgaboudga Posts: 19Questions: 4Answers: 0

    i added a column like this:

    {"data": null, "defaultContent": "0.00"}

  • boudgaboudga Posts: 19Questions: 4Answers: 0

    Can you please provide an example?

  • allanallan Posts: 63,516Questions: 1Answers: 10,473 Site admin

    Of the renderer?

    data: null,
    render: function (data, type, row) {
      return data.quantity * data.price;
    }
    

    (assuming you are using objects that have quantity and price properties).

    Allan

Sign In or Register to comment.