Support

Account

Home Forums Add-ons Repeater Field Pagination for Repeater in Admin Reply To: Pagination for Repeater in Admin

  • Ah I see..
    Yeah I understand your setup now.Unfortunately your issue remains that at some point you’re gonna run into server-limitations.

    The thing about acf_form and manipulating the output would be that it’d affect the repeater field when you save the changes.

    You could probably hide all but the last 5 rows in the form using CSS but that’s a dirty fix.

    So now that I know a bit more and also your requirements here’s what I’d rather do.

    I would create a new CPT called events. Then setup a new field on each company report which is a relationship field for the events posts. You can have this field in your original acf_form is you like just to be able to remove/add posts that already exists.

    Now you say you don’t want your analysts to jump from a single view.
    Well you can create a separate acf_form on the same page with just the fields for each event which when posted creates a new event which automatically connects to the relationship field for the report (you code this yourself, very simple).

    This would also allow you to manually query all events or maybe just the latest 5-10 to display to your analysts. You can also provide an edit-button for each event. This gives you the ability to separate older events from newer in whatever fashion you want. You could also prevent editing of older events by only allowing events from the past month to be edited (for example).

    Anyway, here’s that dirty CSS fix as well.. You’ll have to change “<yourkey>” to the key of the repeater field. This assumes you’ve set your repeater to display as row.

    
    .acf-field-<yourkey> .acf-table tbody .acf-row{
    	display: none;
    	
    }
    
    .acf-field-<yourkey> .acf-table tbody .acf-row:last-child,
    .acf-field-<yourkey> .acf-table tbody .acf-row:nth-last-child(2),
    .acf-field-<yourkey> .acf-table tbody .acf-row:nth-last-child(3),
    .acf-field-<yourkey> .acf-table tbody .acf-row:nth-last-child(4),
    .acf-field-<yourkey> .acf-table tbody .acf-row:nth-last-child(5) {
    	display: table-row;
    
    }