Support

Account

Home Forums Add-ons Repeater Field Disable reordering of the repeater field items Reply To: Disable reordering of the repeater field items

  • Hey @hube2 Thanks a lot!! 🙂
    It’s funny because I just found the same solution :-))
    Here is what I got:

    (function($) {
    	
    	jQuery( document ).ready( function( $ ) {
    		
    		if ( typeof acf !== 'undefined' ) {
    			
    			acf.addAction('load_field', function( field ) {
    				if ( field.data.name === 'locations') {
    					
    					const locationsField = field.$el[0];
    					const acfTable = locationsField.querySelector('.acf-table');
    					const acfTableRows = acfTable.querySelectorAll('.acf-table .acf-row');
    					
    					acfTableRows.forEach((row, index) => {
    
    						const handle = row.querySelector('.acf-row-handle');
    						handle.classList.remove('order');
    
    					});
    
    				}
    				
    			});
    
    		}
    	});
    	
    })(jQuery);

    I will have a look at what you did as well…