2 Replies Latest reply on Feb 22, 2008 12:30 AM by pchris1977

    Adding Item into XMLListCollection


      I store my data into a XMLListCollection variable (name XC). The initial lengt of this XMLListCollection is 10 items (for example: XC.length==10). I leave the user to filter this data and I added a filterfunction to this variable. I set another function named sync() that run every 10 seconds (for example). This function is trying to insert an element into XC:XMLListCollection at a specific position (for example 8 XC.additemat(item,8)). After the user filter the data, the length is 2 and when the sync() function is activated, this function call "addItemAt(item,8)" and I receive "Index out of Bound...".
      I know how to read the entire list (XMLList) using the .source properties but I don't know how to insert an element at a specific position (for example 8).

      Please help me (if you know)
      Thanks in advance
        • 1. Re: Adding Item into XMLListCollection
          ntsiii Level 3
          If the user is filtering the data, then how do you decide where to insert your new item? What is the logic? You will have to account for the current filtered state.

          • 2. Re: Adding Item into XMLListCollection
            pchris1977 Level 1
            I want to store this variable on the local disk into a SharedObject. So, if I stored the entire collection (with 10 items), and the server send to the user another item I want to insert this item into the collection even the item received from the server is not visible by the user (because of filtefunction). When the user want to save the data I want to use sharedobject.flush() and I expect to save the entire collection (11 items). When the user enter again in this form I want to show 11 items and the user can filter this items in multuple ways. Thanks for your replay.