So i have this weird problem where my datatable cause the entire webpage to freeze and crash. I have singled out the code that causes the issue.
This is the output for the datatable
output = [
dict(CGName=a, OnStock=nice_numbers(b), BackLog=nice_numbers(c), OrdersPassed=nice_numbers(d),
**{param: e[n16n] for n16n, param in enumerate(next_weeks)})
for a, b, c, d, e in
zip(cg_name, cg_current_stock, cg_backlog_stock, cg_passed_stock, cg_stock)
]
And this is the function nice_numbers
def nice_numbers(number):
number = str(int(number))
clean_str = ‘’
for i in range(len(number)):
if i % 3 == 0:
clean_str = number[-(i+1)] + ‘,’ + clean_str
else:
clean_str = number[-(i+1)] + clean_str
if clean_str[0] == ‘-’ and clean_str[1] == ‘,’:
clean_str = clean_str[0] + clean_str[2:]
return clean_str[:-1]
it seems to freeze when i have too many rows in the data. Is there something i am missing? If i remove the nice_numbers it does not freeze. So it seems that if the callback takes to long that the whole thing crashes.