Hiding TcxGridLevel in TCXGrid depending on master record values
I have a TcxGrid which consists of a master TcxGridLevel and 2 child TcxGridLevels (all of which use a TcxGridDBTableView). I wou开发者_Python百科ld like to hide one of the child levels depending on the value of the master level record values. How do I go about this?
Here is a link to DevExpress describing what you want:
https://www.devexpress.com/Support/Center/Question/Details/Q96738
But this has some disadvantages in my opinion. First it is quite slow with bigger datasets. Second it comes to "flicker" when your master level changes frequently and the grid has to be redrawn. Maybe it is possible to set a filter to your detail-dataset so the details are "empty" when your nmaster has the correct condition. There is a property in TcxGrid to hide empty detail-tabs automatically.
Somewhat out of context but in case the link goes dead again:
1) How can I trigger Level3 OnGetGridView, because Level3 View was not change as I was expected
The OnGetGridView event is raised only once when the detail is first expanded. After the event handler has been executed, the specified GridView’s clone is created and cached so that the event doesn't fire when expanding the same master record next times. If you need the event to be raised later, you can clear all detail clones by calling the master DataController’s ClearDetails method or ClearDetailLinkObject methods.
You can find this information in the "TcxGridLevel.OnGetGridView" topic of the ExpressQuantumGrid's documentation.
2) I am also changing Level2 and Level3 Caption for every Gridview that it showing, but the changing is not automatically, sometime the Detail View need to be close and open again to make the Caption change.
If we're not mistaken, you change the Level's Caption in its OnGetGridView event handler. If so, the new caption isn't applied immediately because painting of the corresponding element isn't completed. As a workaround, you can perform a "delayed" operation by posting a custom message. I've attached a sample project to illustrate this approach in action. Hopefully, it will serve your needs, and adapting it won't be aproblem.
精彩评论