So I'm running an app and I'm allowing the user to enter data into a table. Easy enough...I'm also trying to auto add the sums of the totals as they enter the totals. This works well enough when I do something like...
$(document).on("change", "input[name$='-budget_line_item_february']", function(){
update_budget_total_february();
});
function update_budget_total_february()
{
var total = 0;
$("input[name$='-budget_line_item_february']:visible").each(function(index, element) {
var val = parseFloat($(element).val());
if( !isNaN( val )){
total += val;
}
});
$("#id_february_disabled_budget_total").val((total).toFixed(2));
$("#id_february_budget_total").val((total).toFixed(2));
}
For a limited number of rows. As the rows grow....I'm noticing that performance is starting to take a hit. I'd rather not have to remove this functionality...and have them have to click a button to total everything....but it seems as if I allow unlimited rows...performance will suffer at some point? Because they can enter as many rows as they'd like I realize this is somewhat of a performance impacting operation...correct? Is there any way to provide this functionality in a manner whereas performance won't take as much of a hit?
Thanks in advance for any ideas or suggestions.