2

From the documentation, it says I can have a collaborative list which contains other collaborative objects, namely another collaborative list. Therefore in my "onFileLoaded" event, I have the following code:

var myRoot = doc.getModel().getRoot().get('myList');
var newList = doc.getModel().createList();
newList.push('Level2');
myRoot.push(newList);

I understand that everytime I reload the file, a new list will be added to "myList". Everything works fine except when I reload the document, that's when the API will only give me "myList" and the "newList" is gone and disappeared into thin air. If I add a string or any other data, the data will persist when I reload the document, but not adding another list to the current list. What am I doing wrong? Thanks in advance.

TomYip
  • 43
  • 4
  • I don't see anything wrong with that code snippet, (although that's a bit of an odd time to be creating new elements). How are you verifying that the list isn't persisted? – Cheryl Simon Jul 19 '13 at 17:56
  • That code looks fine to me too, although I don't see where you create 'myList'. If you can share your application, I would be happy to take a look to determine whether this might be a bug in the Realtime API. – Brian Cairns Jul 23 '13 at 19:27

1 Answers1

0

I am not sure why the above does not work for me, but when I moved the list adding codes out of "onFileLoaded", specifically, adding list to lists only when I click on some DOM element, everything works fine. I supposed these codes should be out of "onFileLoaded" anyways, so it's all good and hopefully someone find these useful.

TomYip
  • 43
  • 4