Integration of an input number touchspin column - calculation problem

Integration of an input number touchspin column - calculation problem

XavlightXavlight Posts: 3Questions: 1Answers: 0
edited March 2023 in Free community support

Hi,

I am looking to integrate the possibility of indicating a quantity in a column.
This quantity will then be modifiable.
I would like to make a total of the columns in the footer by using the price column and the quantity for each line.
I have added an extra column 'subtotal' which I will then hide when it works.
The idea was to have one subtotal column per row.
And in the footer, I sum up the total of the subtotal column.

For the 'subtotal' column: why is it not possible to return a calculation in a cell?

{
    targets: col_soustotal,
    render: function(data, type, row, meta) {
        //console.log("data", data, "type", type, "row", row, "meta", meta);

        var prixval = Number(row[col_prix].replace(",",".")); //Si decimal
        var inputrow = $(row[col_qte]).find("input"); //input col_qte
        var qte = inputrow.val(); //Valeur col_qte
        
        console.log(prixval, qte, qte * prixval);
        
        return qte * prixval;
    },
    //visible: false

},

But I can't find a solution.

Do you have any idea how I can get out of this.

I'm sorry for my bad English.

https://live.datatables.net/xuhibisi/1/edit

Xav

Sign In or Register to comment.