$.repeat(group, callback)
Description:
Begin an sequential loop that iterates instantly for a named thread group.
- group –
string
, optional - a name of the thread group that this loop should be assigned to.
- Defaults to the empty string
''
. - callback –
function(count…)
, optional - a method that is called once per loop iteration.
- All current iteration counts (from inner-most to outer-most loop) are passed as arguments.
The static $.unrepeat() allows to break repeat-loops started this way.
Examples with static instant loop
Example #5: create dynamic tables with instant loops
Imagine you want to add very many table rows automatically so you can fill them with dynamic content.
E.g. a 30 x 200 sized table. Then you need only one callback method creating each cell.
The rest is done via a single jQuery chain:
function createCell(x,y) {
$('<td>').text(x+':'+y).appendTo(this);
}
$.repeat().$('<tr>').repeat(createCell).until(30)
.appendTo('tbody').until(200);
My dynamic data: