Bug? Nested loops, Insert field-button
-
I’m just starting out but I think I’ve found a bug.
I’m using nested loops. Repeatable Rows which then contains repeatable Tiles.When I try to add a new row by using the +button a tile is created but in the hierarchy of my rows.
A visual demonstration
–Row (When I click the +button here …)
–Tile
–Tile
–Tile (… a Tile is created here. It should be a Row.)So basically I try to add a loop element but instead a sub-loop is inserted in its place.
It might have something to do with this code, but I’m not much of a coder myself.
Any suggestions?
$(document).on('click', '.cfs_insert_field', function(event) { event.stopPropagation(); var $add_field = $('.cfs_add_field'); var num_rows = $add_field.attr('data-rows'); var loop_tag = $add_field.attr('data-loop-tag'); var loop_id = loop_tag.match(/.*\[(.*?)\]/)[1]; var html = CFS.loop_buffer[loop_id].replace(/\[clone\]/g, loop_tag + '[' + num_rows + ']'); $add_field.attr('data-rows', parseInt(num_rows)+1); $(html).insertAfter( $(this).closest('.loop_wrapper') ).addClass('loop_wrapper_new'); $add_field.trigger('cfs/ready'); });
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Bug? Nested loops, Insert field-button’ is closed to new replies.