DubFriend / jquery.repeater

Create a repeatable group of input elements
MIT License
389 stars 191 forks source link

isFirstItemUndeletable doesn't work if you use setList() #92

Open viniciusbig opened 6 years ago

viniciusbig commented 6 years ago

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.

andichapras commented 5 years ago

same with me, how to make it work?

viniciusbig commented 5 years ago

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.

gadgetto commented 5 years ago

Same problem here! Any solution?

bebaps commented 5 years ago

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; }

lcabre commented 3 years ago

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

karandocs commented 3 years ago

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

stevens7mb commented 3 years ago

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;
    }
adrianriyadi commented 1 year ago

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

best and simple solution