用于编辑存储在服务器上的对象的通用 DataGrid
我已经组装了一个 Java/BlazeDS 服务器,它创建了一个通用的 GridBean 对象。这个GridBean包含:
List
,其中ColumnDef包含列标题、字段名称List
然后,我创建了一个 Flex 应用程序,它使用 RemoteObjectServiceWrapper
调用我的 java 服务器,获取 GridBean
,创建一些来自 columnDefs
的 DataGrid
列,然后将 dataProvider
设置为对象列表。好的,到目前为止,一切都呈现了。
现在,我真正想做的是:在 Flex 端设置某种事件处理程序,以便如果在数据网格中编辑我的项目/对象,我会向 java 发出一条消息,说“在此编辑了此字段”物品'。最终目标是有一个很好的通用方法来在 Flex 数据网格中呈现 Java 中的任何对象列表。
I've knocked together a Java/BlazeDS server which creates a generic GridBean object. This GridBean contains:
List<ColumnDef>
where a ColumnDef contains the column header, field nameList<Object>
where my object is some java pojo containingPropertyChangeSupport
I then created a Flex app that uses a RemoteObjectServiceWrapper
to call my java server, grab the GridBean
, create some DataGrid
columns from the columnDefs
and then set the dataProvider
as the list of objects. Ok so far, everything renders.
Now, what I'd really like to do is: set up some kind of event handler on the flex side so that if my item/object is edited in the datagrid, I fire a message off to java saying 'edited this field on this item'. The end goal is to have a nice generic way to render any list of objects from Java in a flex datagrid.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
实际上,您正在谈论 ManagedObjects,BlazeDS 本身不支持 ManagedObjects。 (它作为 LCDS 的开箱即用功能提供)。
但是,有第三方工具可以为您提供此功能。
Farata 系统提供Clear Builder (我相信它通过生成的代码提供 CRUD 支持)。
还有 dpHibernate (我应该透露我是它的主要开发人员之一)。
使用 dpHibernate,您所追求的目标是可以实现的,如下所示:
您的实体类(在本例中为
Book
)只需要实现几个简单的接口方法(主要处理身份的概念) ),并且不需要任何生成的代码。此处提供了此更新功能的相当完整的工作示例。
Effectively you're talking about ManagedObjects, which are not supported natively in BlazeDS. (It's available as an out-of-the-box feature of LCDS).
However, there are 3rd party tools which give you this functionality.
Farata systems offers Clear Builder (which I believe offers CRUD support via generated code).
There's also dpHibernate (which I should disclose I'm one of the main developers of).
Using dpHibernate, what you're after is achievable like so:
Your entity class (in this example,
Book
) is only required to implement a couple of simple interface methods (which deal primarily with the concept of identity), and does not require any generated code.There's a pretty complete working example of this update functionality available here.