Number Input Inside Column Resets

Number Input Inside Column Resets

permapugpermapug Posts: 1Questions: 1Answers: 0

I have a table with 2 columns. The first column is a number input field and the second is a default number. When you put in a number and click off the textbox a calculation is done and the second column is updated with the newly calculated value. My problem is that when you click off the textbox it automatically clears the value in the textbox. If I set a default value it will automatically set it to the default value. Is there a way to make it so it keeps the value in the textbox the value that was typed in?

Thanks!

This is the code that is executed when you click off the textbox.

                    var num = parseFloat(this.value)
                    var rowData = grossCombined.rows($(this).closest("tr")).data()[0];

                    let newValue = rowData.basis - (value2 * rowData.futurePrice) + (value2 * num)
                    let calcFinalPrice = parseInt(newValue) + parseInt(num);

                    rowData.finalPrice = calcFinalPrice;


                    grossCombined.rows($(this).closest("tr")).invalidate().draw();        

Answers

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

    We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

This discussion has been closed.