Loading ...
Sorry, an error occurred while loading the content.

Re: dynamic carousel - adding/removing items

Expand Messages
  • kschellner
    Hi Gopal, thanks very much for your answer and the patch! It seems to work with your patched removeItem -method. I still have some problems when operating my
    Message 1 of 3 , Nov 4, 2008
    • 0 Attachment
      Hi Gopal,

      thanks very much for your answer and the patch! It seems to work with
      your patched "removeItem"-method.

      I still have some problems when operating my dynamic carousel (e.g.
      navigation is jumping), but this has maybe another cause ... I will
      investigate on this.

      thanks,
      karin.



      --- In ydn-javascript@yahoogroups.com, "Gopal Venkatesan
      (गोपाल वेंकटेसन)" <gopal@...> wrote:
      >
      > On Wed, Oct 29, 2008 at 5:05 AM, kschellner <karin.schellner@...> wrote:
      > > Hi,
      > >
      > > I want to dynamically add and remove items in the carousel widget (YUI
      > > 2.6.0) but this is not fully working, maybe I miss something.
      > > I tried with two different approaches:
      > >
      > > 1.)
      > > // use of clearItems method to empty the carousel, then add new items
      > > carousel.clearItems();
      > > for (var i=0;i<childrenArray.length;i++) {
      > > html = "<li class='item'>";
      > > ...
      > > html = html+"</li>";
      > > carousel.addItem(html);
      > > }
      > >
      > > 2.)
      > > // delete all items in a loop, then add new items
      > > len = carousel.getItems().length;
      > > for (var j=0; j<len;j++) {
      > > carousel.removeItem(j);
      > > }
      > > for (var i=0;i<childrenArray.length;i++) {
      > > html = "<li class='item'>";
      > > ...
      > > html = html+"</li>";
      > > carousel.addItem(html);
      > > }
      > >
      > > In the first case, the carousel is no longer working properly,
      > > navigation, etc.
      > > In the second case, the carousel seems to work fine, but the list of
      > > items is not completely deleted, one old item stays behind, and is
      > > listed together with the new items in the carousel.
      > >
      > > Do I need to call a refresh, re-render or something on the carousel or
      > > how else can I achieve a dynamic change of the contents of a carousel?
      >
      > Karin:
      >
      > The first method is the preferred method. But due to a bug in
      > Carousel, it doesn't seem to work. If you haven't done so, please
      > file a bug for the same.
      > As a quick fix, I've included a patch for the same and it worked with
      > my quick test script. Please tell me if it worked for you.
      >
      > http://gopalarathnam.com/software/yui/260/carousel_removeItem_patch.js
      >
      > --
      > Gopal Venkatesan
      > http://g13n.in/
      >
      > Note: if you see question marks (?????) after my name in the From
      > header, then your mail tool is not Unicode enabled!
      > You should see my name (Gopal Venkatesan) in Hindi (गोपाल
      वेंकटेसन)
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.