Question: What is the best way to retrieve objects based on obj_uuid
Today one of the ZoomFlex users asked this question:
In ZoomFlex, what is the best way to retrieve objects from server-side classes based on obj_uuid? Do I have to write my own server-side function (and client-side Cairngorm structure) to accomplish something like this?Here is the answer: The best and quickest way to accomplish this is by using the server-side getObjects() method that is inherited by all ZoomFlex classes.
The following code demonstrates how to use this in a Delegate class:
public function getSomethingByID(ev:GetSomethingByIDEvent):void {
var oArgs:Object = new Object();
oArgs["obj_uuid"] = ev.obj_uuid;
__rds.addEventListener('event_getSomethingByID',onResults_getSomethingByID);
__rds.invoke(new YourVO(), "getObjects","event_getSomethingByID",oArgs,false,true);
}
To use this piece of code, you'd need to pass in a property called "obj_uuid" in the GetSomethingByIDEvent.
Also, replace "getSomethingByID" to your own method name. Also replace YourVO() with the client-side VO of the server-side class you are calling. So if you are calling a server-side class called "cars", you would change this to CarsVO().
More about the getObjects() function can be found in the ShadoCMS documentation.
Comments
There are no comments for this page as yet.
print page
