Support

Account

Home Forums Add-ons Repeater Field Update Repeater In admin

Helping

Update Repeater In admin

  • Hello

    I am trying to update the repeater field while in the backend, where i can see a list of all custom post.

    So for i have this in my functions.php:

    function delta_deadline_column($cols) {
         $cols['deadline'] = __('App Deadline', 'ncstate_emg');
         return $cols;
    }
    add_filter('manage_de_program_posts_columns', 'delta_deadline_column');
    function delta_deadline_value($column_name, $post_id) {
      ?>
      <?php if (('deadline' == $column_name)) :?>
        <?php
        global $post;
        $app_deadlines = get_field('app_deadlines', $post->ID);
        ?>
         <div class="edit_cost_button" id="deadline<?php echo $post_id;?>">Edit Deadline</div>
         <div class="cost_editor" id="deadline_editor<?php echo $post_id;?>" style="display:none;">
           <div class="cost_editor_table">
             <div class="close_cost_editor">X</div>
             <div class="cost_editor_cell" id="append_costs<?php echo $post_id;?>">THIS IS WHERE I WNT TO SHOW THE REPEATER FIELD</div>
             <div class="cost_cell_buttons"><div class="edit_cost_button green" id="update_deadline<?php echo $post_id;?>">Update Deadline!</div></div>
           </div>
         </div>
         <script>
         (function( $ ){
           $('#deadline<?php echo $post_id;?>').click(function(){
             $('#deadline_editor<?php echo $post_id;?>').show();
          });
          $('.close_cost_editor').click(function(){
            $('.cost_editor').hide();
          });
    
            var ajaxUrl = "<?php echo site_url();?>/wp-admin/admin-ajax.php";
            var postid = <?php echo $post_id;?>;
          $("#update_deadline<?php echo $post_id;?>").on("click",function(){
          var content = SHOULD DISPLAY THE REPEATER WITH CURRENT VALUE
              $.post(ajaxUrl, {
                  action:"update_deadline_programs",
                  update_costs: content,
                  postid: postid
              }).success(function(posts){
                location.reload();
              });
    
         });
         })( jQuery );
         </script>
      <?php endif;?>
    <?php
    }
    add_action('manage_de_program_posts_custom_column', 'delta_deadline_value', 10, 2);
    
    function update_deadline_programs(){
        $post_id = $_POST["postid"];
        $value = $_POST["update_costs"];
        $field_key = "field_5c58a5e6d1bff";
        update_field( $field_key, $value, $post_id );
           exit();
    }
    
    add_action('wp_ajax_nopriv_update_deadline_programs', 'update_deadline_programs');
    add_action('wp_ajax_update_deadline_programs', 'update_deadline_programs');

    Can you help me figure out what to append in the popup?

    Thank you!

  • I cannot find much information on how to add ACF field to quick edit. You might want to check out how this does it https://github.com/mcguffin/acf-quick-edit-fields or maybe check out this https://www.admincolumns.com/advanced-custom-fields-columns/

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Update Repeater In admin’ is closed to new replies.