Ticket T437813
Visible to All Users

How to specify what DetailView is shown by the Open Related Record action execute or ctrl shift key combination click

created 8 years ago

Hi

I'm trying to achieve something which I thought that  T296003 addressed.

"Starting with version 15.1.8, you can easily specify a custom DetailView for ObjectPropertyEditor via the Model Editor at the DetailView | Items or ListView | Columns node levels in the Application Model:"

What I'm trying to achieve is that when I ctrl shift click on a field in a LV that it shows a specific detailview  for the clicked object.

So, using the main demo as an example, in the model I clone and customise a view from Position_DetailView as Position_DetailView_Copy.

Then on the Contact_ListView I try and set this as the View under the column "Position" . The drop down for View is limited to list views though. If I change the property editor to a DetailPropertyEditor, I can then choose a detail view - but ctrl clicking on the list view field still appears to be using the default detail view for position.

Have I misunderstood what this change should achieve ?

Answers approved by DevExpress Support

created 8 years ago (modified 8 years ago)

Hello Chris,

Changes described in these tickets are applied only to the ObjectPropertyEditor. To change the DetailView shown when the Ctrl+Shift+Click combination is used or the Open Related Record action is executed, use the OpenObjectController.CustomOpenObject event. Here is an example:

C#
using DevExpress.ExpressApp; using MainDemo.Module.BusinessObjects; using DevExpress.ExpressApp.Win.SystemModule; namespace MainDemo.Module.Win { public class WinViewController1 : ViewController { OpenObjectController openObjectController; protected override void OnActivated() { base.OnActivated(); openObjectController = Frame.GetController<OpenObjectController>(); if (openObjectController != null) { openObjectController.CustomOpenObject += WinViewController1_CustomOpenObject; } } void WinViewController1_CustomOpenObject(object sender, CustomOpenObjectEventArgs e) { if (e.ObjectToOpen is Department) { e.Handled = true; IObjectSpace objectSpace = Application.CreateObjectSpace(e.ObjectToOpen.GetType()); e.InnerArgs.ShowViewParameters.CreatedView = Application.CreateDetailView(objectSpace, "Department_DetailView_Copy", true, objectSpace.GetObject(e.ObjectToOpen)); } } protected override void OnDeactivated() { base.OnDeactivated(); if (openObjectController != null) { openObjectController.CustomOpenObject -= WinViewController1_CustomOpenObject; openObjectController = null; } } } }

Refer to the Customize Controllers and Actions topic for additional information.

    Show previous comments (9)
    Dennis Garavsky (DevExpress) 8 years ago

      You're always welcome here, Chris

      CR CR
      Chris Royle (LOBS) 8 years ago

        The simple solution worked for me, thanks Dennis.

        Dennis Garavsky (DevExpress) 8 years ago

          Anytime, Chris

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.