KB Article A2735
Visible to All Users

How to reorder detail tabs in the master-detail view

Description:
How do I change the order of the detail tabs?

Answer:
Actually, it is possible to reorder detail tabs. Just there isn't any editor to do this visually. Please let us explain this possibility using the Master-Detail demo example:

  1. Open the GridMainDemo project, build it and open the MasterDetail module.
  2. You may see that the Grid has several levels and Views defined.

    The hierarchical structure of the levels is stored in the LevelTree property. You can change the order of the defined levels by editing the InitializeComponent method (the Designer generated code).
    Look for the LevelTree code. You will find a line which adds two nodes. They correspond to the SuppliersProducts and SuppliersCategoryProducts

    Reorder the nodes in the AddRange method:
C#
this.gridControl1.LevelTree.Nodes.AddRange(new DevExpress.XtraGrid.GridLevelNode[] { gridLevelNode3, gridLevelNode1});

Rebuild the project and open the Designer. You will see that the levels have reflected your change.

3. Finally, you must set the GridControl.ShowOnlyPredefinedDetails property to true to prevent the Grid from using more levels than are explicitly defined. Also, enabling this option cancels re-building the level tree according to the data source schema at runtime. This way, changes made in the designer file will be reflected at runtime.
Here is the resulting view of the Grid at runtime:

NOTE: Be careful editing the Designer Generated code. You can break the components on your form, so that when the form is saved next time, the controls are removed and cannot be restored.

Show previous comments (5)
Andrew Ser (DevExpress Support) 7 years ago

    Hello Christophe,
    Let's discuss this case separately in a ticket I've created from your behalf - Grid - Reordering detail tabs in the master-detail view stops working after enabling ShowOnlyPredefinedDetails. Thank you for your cooperation in advance.

    JS JS
    Joerg Schreder 7 years ago

      Hello support team,

      Is there a way to do the tab ordering programatically? I don't use the designer to set up my views.

      Thank you.

      DevExpress Support Team 7 years ago

        Hello,

        I've created a separate ticket on your behalf (T604813: How to re-order detail views). It has been placed in our processing queue and will be answered shortly.

        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.