Hi
I have a carousel with some carousel items and I want to get a previous item root id.
This is the structure of each of my carousel items is like this.
There is a root element with children _image and _navigation. Now, when each carousel item is added via abstract designer or otherwise, I'd like it to determine whether there is already a previous item already inside the carousel. I am able to find the previous item with this code, which is inside the custom view design of each carousel item.
This however returns the complete element, which is expected. What I'm struggling to get is the id of the root element.
For example, in my web console. I log previousSibling result.
I have about 4 carousel items. So when sdui5carouselitem2 is added, it finds that we have a previous sibling, sdui5carouselitem1 and returns the complete DOM. What I need to get is the id sdui5carouselitem1 for example.
I have tried prev.Name and prev.getattr("id") and nothing is returned?
Thanks in advance.
I have a carousel with some carousel items and I want to get a previous item root id.
This is the structure of each of my carousel items is like this.
B4X:
mElement = mTarget.Append($"[BANCLEAN]
<div id="${mName}" class="${xclasses}" ${xattrs} style="${xstyles}">
<img id="${mName}_image" src="${sImage}" alt="" class="bg-cover bg-center bg-no-repeat"></img>
<div id="${mName}_navigation" class="absolute left-5 right-5 top-1/2 flex -translate-y-1/2 transform justify-between">
<a id="${mName}_prev" href="#${sPrevItem}" class="btn btn-circle bg-base-100/70 hover:bg-base-100">❮</a>
<a id="${mName}_next" href="#${sNextItem}" class="btn btn-circle bg-base-100/70 hover:bg-base-100">❯</a>
</div>
</div>"$).Get("#" & mName)
There is a root element with children _image and _navigation. Now, when each carousel item is added via abstract designer or otherwise, I'd like it to determine whether there is already a previous item already inside the carousel. I am able to find the previous item with this code, which is inside the custom view design of each carousel item.
B4X:
private Sub GetPreviousSibling(el As BANanoElement) As BANanoElement
Dim prev As BANanoElement = el.GetField("previousSibling")
If (prev = Null) Or (prev = BANano.Undefined) Then Return Null
Return prev
End Sub
This however returns the complete element, which is expected. What I'm struggling to get is the id of the root element.
B4X:
<div id="${mName}" class="${xclasses}" ${xattrs} style="${xstyles}">
For example, in my web console. I log previousSibling result.
I have about 4 carousel items. So when sdui5carouselitem2 is added, it finds that we have a previous sibling, sdui5carouselitem1 and returns the complete DOM. What I need to get is the id sdui5carouselitem1 for example.
I have tried prev.Name and prev.getattr("id") and nothing is returned?
Thanks in advance.