jquery.repeater icon indicating copy to clipboard operation
jquery.repeater copied to clipboard

isFirstItemUndeletable doesn't work if you use setList()

Open viniciusbig opened this issue 5 years ago • 8 comments

To start the repeater with some data, using the setList() function, the first element on the repeater is showing the delete button even is isFirstItemUndeletable is set to true.

viniciusbig avatar Jul 23 '18 02:07 viniciusbig

same with me, how to make it work?

andichapras avatar Sep 22 '18 03:09 andichapras

I couldn't.

I dropped the idea of using a setList() and create my own logic by triggering the click event on add and remove buttons.

viniciusbig avatar Sep 22 '18 16:09 viniciusbig

Same problem here! Any solution?

gadgetto avatar May 28 '19 18:05 gadgetto

I just cheated a bit and used some CSS. In my case I wanted to remove the delete button from fields that are required in my form, so I added a .required-item class to the parent element of the button and did .required-item:first-of-type [data-repeater-delete] { display: none; }

bebaps avatar Aug 29 '19 20:08 bebaps

I ran into the same problem, I made a file with a quick fix, the only thing you have to do is include it before the jquery,repeater library https://gist.github.com/lcabre/d2ca0389abee4c75f4822cd6ce93433c

lcabre avatar Dec 17 '20 23:12 lcabre

I solved it using css - [data-repeater-item]:first-child [data-repeater-delete] { display: none; }

karandocs avatar Mar 15 '21 06:03 karandocs

Hello I have another solution data-repeater-list = description

  1. Set name to delete button
               <button class="btn btn-icon btn-danger rounded-circle" type="button" data-repeater-delete id="dButton" name="dButton" >
                  <i class="bx bx-x"></i>
              </button>
  1. Create css using name button
  button[name="description[0][dButton]"] {
       display: none;
   }

stevens7mb avatar Aug 31 '21 21:08 stevens7mb