为做用ECO作数据源的嵌套表格,想了许多办法达不到好的效果,今天在GOOGLE上几行字的一个回复,让我如获至宝,随即问题迎刃而解
"Oleg Zhukov" wrote: > For this purpose I use events for loading details. For example see > GridView.MasterRowGetChildList event. There is good help written > on this topic. I've just noticed that it's much easier to do this using nestings in ECO handles. (Earlier I thought that nestings are suitable only for WinForms DataGrid, but it seems to be an ECO-specific implementation of general .NET master-detail architecture)
Just create a column in a handle and set "nested = true". Then in "nestings" property for the handle you may adjust fields for this nesting.
In DevExpress GridControl create new level (pattern view) and set this level's name to the name of the nesting. Done! :)
Regards, -- Oleg Zhukov 我假定两个库,一个person库,一个parent库,一对多的关系
1.建一个expressionhandle,设其expression='person.allinstances',
2在这个expressionhandle中,进入columns新建一列,取名parents,expression设为"self.parents",nestingsname设为'mx'(随便取的),nested设为true.
3.仍在这个expressionhandle中,进入nesting,加入一行,取名为同上的"mx",adddefaultnesting(增加默认嵌套)设为false和adddefaultproperties(增加默认属性)设为true,其它可不设.
4.在gridcontrol中,在原先已默认已建一级gridview的基础上新建一个level,在这个level上再建一个gridcontrol,假定是gridview2,将它的名字改为我先取的nesting(嵌套)名"mx",这时运行表单,看到gridcontrol就是自己心中期望的那个嵌套效果.
|