Home › Forums › Feature Requests › Add filter for row number in repeater field
Right now, it’s hardcoded to just numbers, but I want to be able to replace these with icons. So a filter that feeds me the current row’s data so I can use it to return different text / a dashicon would be fantastic.
Hi @simpleways
I’m afraid I don’t understand your issue. Could you please share some screenshots of the issue? You can also share the code you’re using now.
Thanks!
Hi @simpleways
I believe you can hide the number using CSS like this:
function my_acf_admin_head1() {
?>
<style type="text/css">
.acf-field-56d9c106c8503 .acf-row-handle.order span{visibility: hidden;}
.acf-field-56d9c106c8503 .acf-row-handle.order span:before{visibility: visible;}
</style>
<?php
}
add_action('acf/input/admin_head', 'my_acf_admin_head1');
Hope this helps!
One last thing, whenever I ‘append’ (meaning add a new row), it triggers the ‘append’ event AND the ‘remove’ event, while removing a row only triggers the ‘remove’ event – is that a bug?
Hi @simpleways
I think the repeater uses the remove function to re-order the rows. But to make sure, I’ll let the plugin author know about this.
Thanks!
Hi @simpleways
Thanks for the JS questions.
The ‘remove’ action is fired when adding a new row due to the logic within the acf.duplicate() function.
ACF duplicates the element (repeater row) and runs the ‘remove’ action on the newly created row. This removes unwanted elements and reverts the row to it’s ‘default’ state, so that the ‘append’ action can run as intended.
I’m sure there is a way for your JS to work.
Can you specify exactly what part of your JS code is not working as intended because of this?
The topic ‘Add filter for row number in repeater field’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.