I have a Canvas that contains some images (photos). Is there any way, I can “load” the entire Canvas with its’ children (the photos Img objects) from DB? For instance, if a user needs to load a particular Album/Portfolio, they can select one and click on Load. This should load a Canvas with all the images preloaded. I am guessing I can do
isc.Canvas.create(canvasproperties) where canvasproperties contain all the properties including children attribute. The canvasproperties should probably be generated on the server. The question is: How do I load it via AJAX? The server can return data in any format js, json or xml (using ruby on rails).
UPDATE: I was able to use RPCManager to retrieve Javascript data from the server. However, I still have one small problem. I have a main Canvas “main”. In my server code, I return a JS with isc.Canvas.create({“child”, … children :}) and the RPCRequest is set to eval the output, so basically I do mainCanvas.addChild(data) and this works perfectly and I get this child canvas within the main canvas. The child canvas has a number of Img objects and they all show up fine.
However, what I’d ideally like is for those Img objects to become children of the “main” canvas. I tried doing mainCanvas.setProperty(“children”, data) (making sure that the server only returns [isc.Img.create(…), isc.Img.create(..) ]) and then a redraw, but it did not add it (the developer console Watch tab doesn’t list the Img objects are the children of main). In fact, these never get added anywhere.
What am I doing wrong? Is there another way to do this (is there a addChildren that I am missing)?
thanks.