Display if is first or last item in dmx-repeat

What condition I need to use to display element if is the first or last element inside the dmx-repeat

<div class="col-md-6 px-1 project-box mb-2" dmx-repeat:repeatprojects="projectListServer.data.projectList">

CONTENT HERE 
 
</div>


Captura de Pantalla 2024-08-20 a la(s) 11.08.16

Is this possible?

Can you explain more on what you are trying to achieve? If you are only displaying first or last record, why are you using a repeat?

I have a repeat region with inside action buttons. I want to display button only on the first and the last element from the repeat region.

Maybe css is what you need

yourRepeat.button {
  display:none;
}

yourRepeat.button:first-child , 
yourRepeat.button:first-child {
  display: block;
}

Assume the button display type is block... If not, declare it accordingly on first & last child (eg flex...)

I use this

dmx-hide="$index==0"

and

dmx-hide="projectListServer.data.projectList.count()-1==$index"
2 Likes