I need a way to add records in a certain cycle(in each cycle I want to add 100 records) to the w2ui grid. However, I do not want to use a for a loop. Instead, I would like to add sleep(or one of its alternatives) in every 100 records. Otherwise, 1000 records are printed at the same time which is not useful for me. One part of my current code is like this:
...
for (let i = 0; i < Object.keys(msgs[j].internal_list).length; i++) {
record_entries = {
recid: msgs[j].chnl_name + "_" + msgs[j].msg_name + "_" + idx_msgs,
chnl_name: msgs[j].chnl_name,
msg_name: msgs[j].msg_name,
msg_id: msgs[j].msg_id,
msg_type: msgs[j].msg_type,
can_frame_time: msgs[j].internal_list[i].t,
msg_dir: msgs[j].internal_list[i].msg_dir,
interval: msgs[j].internal_list[i].interval,
min_interval: msgs[j].internal_list[i].min_interval,
max_interval: msgs[j].internal_list[i].max_interval,
raw_data: msgs[j].internal_list[i].raw_data
}
if (((idx_msgs % 100) === 0) || ((j === msgs.length - 1) &&
(i === Object.keys(msgs[j].internal_list).length - 1) && (idx_msgs >= nums_traces)))
{
w2ui['can_frame_grid'].add(record_entries);
// w2ui['can_frame_grid'].sort('can_frame_time', 'asc');
}
else
{
records[idx_msgs] = record_entries;
}
idx_msgs += 1;
}
...