Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

remove items in cycleview using javascript

is it possible to remove items from the cycleview component using javascript ?

Best Answer
6 REPLIES 6

to add to this ive tried using css and js code to hide one of the items and also tried ot remove it.

ive tried to remove the use tag and the image and text inside but they are not there to remove.

Best Answer
0 Votes

Hi sleedoh,

 

I don't know about completely removing them if that's what you're after, but you can certainly hide them. In your index.gui, make sure you give the individual items you're cycling through their own names. E.g.

 

 

<use href="#cycleview-item" id="activeSection">
  <text id="randomText">Hello</text>
</use>

 

 

Then in your app code, get a handle to that specific cycleview item:

 

 

let activeSection = document.getElementById("activeSection");

 

 

Once you have the handle you can show and hide that item using display="none" and display="inline":

 

 

// To hide the element:
activeSection.style.display = "none";

// To show it:
activeSection.style.display = "inline";

 

 

Cheers,

Paul.

Best Answer
0 Votes

I have a similar issue. I thought I could use the style.display tag and set it to none, but as I cycle through the elements, the cycleview glitches as it comes to the element that was removed.

Best Answer
0 Votes

Do you want to remove it so users don't see it, or allow them to select which items to cycle on screen?

Best Answer
0 Votes

Would be useful to remove it so it doesn't get cycled through. If we just hide it then it will be cycled as an emtpy view. 

My use case is for the stats cycle items in the sdk moment sample project i want to remove the elevation for versa lite only.

Best Answer

I wasn't able to make this work either. My suggestion would be to either implement your own, or have 2 cycle views, and just hide/show the entire thing. I have an internal ticket for this issue.

Best Answer