Title: break up repeatable record groups into sections?
Last modified: July 28, 2019

---

# break up repeatable record groups into sections?

 *  Resolved [dkurth](https://wordpress.org/support/users/dkurth/)
 * (@dkurth)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/break-up-repeatable-record-groups-into-section/)
 * Some of my lists are getting long to load. While I know I am loading the data
   directly, that would continue to be no problem, if I could break up the record
   set into sections like the custom post do.
 * Such as in this screen grab: [https://snag.gy/njsJpF.jpg](https://snag.gy/njsJpF.jpg)
 * Is there a way in CMB2 to put navigation in place for each repeatable record 
   set?
    -  This topic was modified 6 years, 11 months ago by [dkurth](https://wordpress.org/support/users/dkurth/).
    -  This topic was modified 6 years, 10 months ago by [Jan Dembowski](https://wordpress.org/support/users/jdembowski/).
      Reason: De-capped topic title, don't yell please

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

 *  Plugin Contributor [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [6 years, 10 months ago](https://wordpress.org/support/topic/break-up-repeatable-record-groups-into-section/#post-11732858)
 * Anything like this would be a custom solution, since I am quite sure we don’t
   have that detail built in, as-is.
 *  Thread Starter [dkurth](https://wordpress.org/support/users/dkurth/)
 * (@dkurth)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/break-up-repeatable-record-groups-into-section/#post-11760854)
 * ok, this is how it could be done, if you can tell me where I would “add a button”
   for the group
 * presently a repeatable group assignment looks like this:
 *     ```
       $group_field_id = $cmb->add_field( array(
       	'id'          => 'MMDListsRecord',
       	'type'        => 'group',
       	'description' => __( 'Individual Directory Listings', 'mmd' ),
       	'options'     => array(
       		'group_title'       => __( 'Record {#}', 'mmd' ), // since version 1.1.4, {#} gets replaced by row number
       		'add_button'        => __( 'Add Another Record', 'mmd' ),
       		'remove_button'     => __( 'Remove Record', 'mmd' ),
       		'sortable'          => true,
       		'closed'            => true,
       	),
         'after_group' => 'mmdlist_add_js_for_repeatable_titles',
       ) );
       ```
   
 * What I would like to do is add 2 buttons like this:
 *     ```
       $group_field_id = $cmb->add_field( array(
       	'id'          => 'MMDListsRecord',
       	'type'        => 'group',
       	'description' => __( 'Individual Directory Listings', 'mmd' ),
       	'options'     => array(
       		'group_title'       => __( 'Record {#}', 'mmd' ), // since version 1.1.4, {#} gets replaced by row number
       		'add_button'        => __( 'Add Another Record', 'mmd' ),
                       'prev_button'       => __( 'Previous Records', 'mmd' ),    <===== ****
                       'next_button'       => __( 'Next Records', 'mmd' ),    <===== ****
       		'remove_button'     => __( 'Remove Record', 'mmd' ),
       		'sortable'          => true,
       		'closed'            => true,
       	),
         'after_group' => 'mmdlist_add_js_for_repeatable_titles',
       ) );
       ```
   
 * This way I can only load say 10 records at a time and thus save the massive amount
   of browser memory and more importantly the SLOWWWWWWW on the backend. Yes, it
   is a LOT of data I am pushing around. This would solve the problem.
 *  Thread Starter [dkurth](https://wordpress.org/support/users/dkurth/)
 * (@dkurth)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/break-up-repeatable-record-groups-into-section/#post-11760865)
 * It appears to be in CMB2.php as:
 *     ```
       if ( $field_group->args( 'repeatable' ) ) 
       {
       echo '<div class="cmb-row"><div class="cmb-td"><p class="cmb-add-row"><button type="button" data-selector="', esc_attr( $field_group->id() ), '_repeat" data-grouptitle="', esc_attr( $field_group->options( 'group_title' ) ), '" class="cmb-add-group-row button-secondary">', $field_group->options( 'add_button' ), '</button></p></div></div>';
       }
   
       echo '</div></div></div>';
   
       $field_group->peform_param_callback( 'after_group' );
       return $field_group;
       }
       ```
   
 * If this is true, and I add the button there, can you tell me where the “buttons”
   are processed. Obviously it is another Javascript thing. And one would need a
   call back to indicate the button has been clicked on, in order to load the next
   data set.
    -  This reply was modified 6 years, 10 months ago by [dkurth](https://wordpress.org/support/users/dkurth/).
    -  This reply was modified 6 years, 10 months ago by [dkurth](https://wordpress.org/support/users/dkurth/).
 *  Plugin Contributor [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [6 years, 10 months ago](https://wordpress.org/support/topic/break-up-repeatable-record-groups-into-section/#post-11761435)
 * Looking at that same file, I’m seeing this:
 *     ```
       if ( empty( $field['render_row_cb'] ) ) {
       	$field['render_row_cb'] = array( $this, 'render_group_callback' );
       }
       ```
   
 * I point this out because the spot you highlight above is in the `render_group_callback`
   function. So, if you specify a custom `render_row_cb` function/callback, you 
   can safely override the spot in question. For ease and some level of compatibility,
   I’d recommend copying `render_group_callback` as is into your own function, but
   then modify as you need afterwards.
 *  Thread Starter [dkurth](https://wordpress.org/support/users/dkurth/)
 * (@dkurth)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/break-up-repeatable-record-groups-into-section/#post-11761761)
 * ok, interesting suggestion. I can give that a go.
 *  Thread Starter [dkurth](https://wordpress.org/support/users/dkurth/)
 * (@dkurth)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/break-up-repeatable-record-groups-into-section/#post-11773521)
 * That was a great idea…that did not pan out. that particular call back only changes
   how the individual row is called and does not add another button to the group.
 * I need to expand the capabilities of the options parameter. This is my present
   call:
 *     ```
       $group_field_id = $cmb->add_field( array(
       	'id'          => 'MMDListsRecord',
       	'type'        => 'group',
       	'description' => __( 'Individual Directory Listings', 'mmd' ),
       	'options'     => array(
       		'group_title'       => __( 'Record {#}', 'mmd' ), // since version 1.1.4, {#} gets replaced by row number
       		'add_button'        => __( 'Add Another Record', 'mmd' ),
       		'remove_button'     => __( 'Remove Record', 'mmd' ),
       		'sortable'          => true,
       		'closed'            => true,
       	),
         'after_group' => 'mmdlist_add_js_for_repeatable_titles',
         'render_row_cb' => 'mmd_render_group_callback',
       ) );
       ```
   
    -  This reply was modified 6 years, 10 months ago by [dkurth](https://wordpress.org/support/users/dkurth/).
 *  Thread Starter [dkurth](https://wordpress.org/support/users/dkurth/)
 * (@dkurth)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/break-up-repeatable-record-groups-into-section/#post-11773526)
 * unless I am totally missing something…
 *  Plugin Contributor [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [6 years, 10 months ago](https://wordpress.org/support/topic/break-up-repeatable-record-groups-into-section/#post-11773703)
 * Well, you need to add it. That’s all on you. I recommended copy/pasting to retain
   all what already exists, and then you add your own and tie into the new markup
   as needed for your current tasks. Just defining and copy/pasting alone isn’t 
   going to add it.
 *  Thread Starter [dkurth](https://wordpress.org/support/users/dkurth/)
 * (@dkurth)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/break-up-repeatable-record-groups-into-section/#post-11774104)
 * I tried adding just simple text to the field area..that is what confused me, 
   since nothing would display..simple
 *     ```
       echo "test message";
       ```
   
 * Right under the button..nada.
 *  Plugin Contributor [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [6 years, 10 months ago](https://wordpress.org/support/topic/break-up-repeatable-record-groups-into-section/#post-11774188)
 * Are you certain your callback is being called and triggered?
 *  Thread Starter [dkurth](https://wordpress.org/support/users/dkurth/)
 * (@dkurth)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/break-up-repeatable-record-groups-into-section/#post-11774404)
 * I can put a debug statement in it to test. But it is connected to the callback
   hook and i have it another name.
 *  Plugin Contributor [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [6 years, 10 months ago](https://wordpress.org/support/topic/break-up-repeatable-record-groups-into-section/#post-11778169)
 * One thing I’ve noticed at times is that even though I try to echo out a simple
   string, when viewing in the browser it doesn’t immediately show, but when I do
   a view-source check, it is indeed there. Depends on exactly where in the html
   markup structure the code is set to echo at.
 *  Thread Starter [dkurth](https://wordpress.org/support/users/dkurth/)
 * (@dkurth)
 * [6 years, 8 months ago](https://wordpress.org/support/topic/break-up-repeatable-record-groups-into-section/#post-12014685)
 * found a way to do it using separate custom posts.
 *  Plugin Contributor [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [6 years, 8 months ago](https://wordpress.org/support/topic/break-up-repeatable-record-groups-into-section/#post-12014763)
 * Awesomesauce.

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

The topic ‘break up repeatable record groups into sections?’ is closed to new replies.

 * ![](https://ps.w.org/cmb2/assets/icon.svg?rev=2866672)
 * [CMB2](https://wordpress.org/plugins/cmb2/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/cmb2/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/cmb2/)
 * [Active Topics](https://wordpress.org/support/plugin/cmb2/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/cmb2/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/cmb2/reviews/)

 * 14 replies
 * 2 participants
 * Last reply from: [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * Last activity: [6 years, 8 months ago](https://wordpress.org/support/topic/break-up-repeatable-record-groups-into-section/#post-12014763)
 * Status: resolved