• Resolved cutox

    (@cutox)


    [Version: 2.3.0]

    Adding / Removing rows doesn’t update row index.

    This problem affects data-iterator attribute and inputs’ id.

    This can cause wrong behavior:
    If using timepicker in a group, you can’t update the correct field after row deletion.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Can you provide the CMB2 metabox configuration that you’re using, so we can try to recreate what you’re experiencing?

    Thread Starter cutox

    (@cutox)

    	$cmb_call = new_cmb2_box( array(
    		'id'            => 'call_metabox',
    		'title'         => __( 'Calendario', 'cmb2' ),
    		'object_types'  => array( 'call' ),
    		'context'       => 'normal',
    		'priority'      => 'high',
    		'show_names'    => true,
    	) );
    
    	$cmb_call_date_group = $cmb_call->add_field( array(
    	    'id'          => '_call_calendar',
    	    'type'        => 'group',
    	    'escape_cb' => false,
    	    'repeatable'  => true,
     	    'options'     => array(
    	        'group_title'   => __( 'Sessione {#}', 'cmb' ), // since version 1.1.4, {#} gets replaced by row number
    	        'add_button'    => __( 'Aggiungi', 'cmb' ),
    	        'remove_button' => __( 'Rimuovi', 'cmb' ),
    	        'closed'    	=> false,
    	        'sortable'      => true, // beta
     	    ),
     	    'sortable' =>true
    	) );
    	
    	$cmb_call->add_group_field( $cmb_call_date_group, array(
    		'name' => __( 'DateTime', 'cmb2' ),
     		'id'   => 'session',
    		'type' => 'text_datetime_timestamp',
    		'date_format' => 'Y-m-d',
    		'time_format' => 'H:i',
    	));
    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Definitely managing to recreate, and from the looks of things, very similar to this issue https://github.com/CMB2/CMB2/issues/707

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Workarounds is frequent saving to get things “realigned” for the moment.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘[Repeatable Group] Wrong index adding/removing rows’ is closed to new replies.