Ticket T512781
Visible to All Users

How to switch between TreeListEditor and GridListEditor in a ListView with DataAccessMode = Server and avoid InvalidOperationException (X does not support Server Mode)

created 8 years ago

[DevExpress Support Team: CLONED FROM S173664: How to refresh View appearance after making changes to the Application Model in code]
2. Problem – start ListView “Test Bo 2” and execute action “SwitchEditor”… OK, the problem is understandable, but what to do with it? Now we avoid this problem, because we set DataAccessMode = Client to the View.Model during View recreating if the editor does not support server mode. In case with Frame.SetView(…) without View recreating it does not work, because the collection source of the View is already created. I didn’t find any solution for this scenario, but just forbid the action if desired editor can’t work in server mode is not the appropriate solution for us.

Answers approved by DevExpress Support

created 8 years ago

Hello,

If a list editor does not support server mode, it is a developer's responsibility to configure the ListView the way it will not cause this exception or avoid this situation at all, e.g., by disabling a corresponding UI command and providing a meaningful tooltip for it.
Alternatively, you can consider using our ViewVariants module instead of implementing a custom-tailored solution. I have modified your sample to demonstrate this solution.

    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.