FLEX 命令的困难同步问题(在 cairngorm 中)
我的问题,简化了: 我有一个带有 dataProvider“文档”的 dataGrid 数据网格的一列有一个 labelFunction,它获取文档的 project_id 字段,并从可绑定变量“projects”返回项目名称
现在,我调度事件以从服务器下载文档和项目,但是如果文档在项目之前下载,然后标签函数给出错误(没有“projects”变量)
因此,我必须序列化正在执行的命令: getDocuments 命令必须仅在 getProjects 命令之后执行。
但在现实世界中,我有几十个正在下载的资源,并且这些命令并不总是组合在一起(因此我无法从第一个命令的 onSuccess() 方法执行第二个命令,因为它们并不总是必须一起执行..)..
我需要一个简单的解决方案..我需要一个想法..
My problem, simplified:
I have a dataGrid with a dataProvider "documents"
A column of the datagrid has a labelFunction that gets the project_id field of the document, and returns the project name, from a bindable variable "projects"
Now, I dispatch the events to download from the server the documents and the projects, but If the documents get downloaded before the projects, then the label function gives an error (no "projects" variable)
Therefore, I must serialize the commands being executed: the getDocuments command must execute only after the getProjects command.
In the real world, though, I have dozens of resources being downloaded, and those command are not always grouped together (so I can't for example execute the second command from the onSuccess() method of the first, because not always they must be executed together..)..
I need a simple solution.. I need an idea..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果我理解正确的话,您需要序列化服务器的回复。我已经使用
AsyncToken
做到了这一点。方法:在调用远程函数之前,为其添加一个“令牌”。例如,一个 id。服务器对该特定调用的回复将包含该令牌。这样您就可以将多个调用分开并创建远程调用链。
实际上这很酷:
If I understand you correctly, you need to serialize the replies from the server. I have done that by using
AsyncToken
.The approach: Before you call the remote function, add a "token" to it. For instance, an id. The reply from the server for that particular call will then include that token. That way you can keep several calls separate and create chains of remote calls.
It's quite cool actually: