Search This Blog

Wednesday, September 9, 2015

How to reset View customizations made by end-users (UPDATE)

I invite you to test an updated version of the previous E1897 solution (it is now marked as obsolete), which we are planning to include in v15.2 by default. The new solution supports both WinForms and ASP.NET apps and also works for both the root and nested Views (e.g., the ones embedded into ListPropertyEditor and DetailPropertyEditor):


Testing


To test this new solution in the current v15.1, include this C# source file into YourSolutionName.Module project (vb.net guys can either use this approach OR convert this code into their language using free tools).

Poll question

I also have a question to you: what is the best location for the Reset View Settings command?
1. In a separate Tools sub-menu (one per root form);
2. In the toolbar accompanying each View (may be too noisy);
3. Suggest other locations and demonstrate them with screenshots (e.g., context menu).


I am looking forward to hearing from you.

19 comments:

  1. Good stuff, cheers Dennis.

    I'd say in a context menu whilst right clicking the header.

    ReplyDelete
    Replies
    1. Thanks! What about non-grid ListView without headers as well as DetailView? If possible, please illustrate your answer with screenshots.

      Delete
  2. Hey Dennis,
    i think in context menu of column header is the best solution! I can add colums at this place end finally reset my view! Thanks!!

    ReplyDelete
    Replies
    1. Thanks, Jens! Am I correct that you do not need this reset functionality for DetailView and non-grid ListView?

      Delete
    2. give me a sample for non-grid listviews?! did you mean scheduler or someone?
      Detailview can currently reset in contextmenu of layoutcontrol. it's ok!

      Delete
    3. Yes, scheduler, pivot, charts, etc.
      As for the DetailView, you're right about the existing layout control's context menu. I was primarily interested in having a universal "reset" command available for any View. As far as I interpreted your answer, you do not need new options except for the context menu in grids, correct?

      Delete
    4. yes, the grid functionality would perfect in header menu. for detailview the current solution is enough.

      Delete
    5. Thanks for taking the time to answer, Jens. I appreciate it.

      Delete
  3. Context menu, the one that lets you add and hide columns.

    ReplyDelete
  4. Nice work!

    Sometimes when you make some customization to the grid, and have some data error, it starts showing errors messages when you click on the grid, so putting the reset view on context menu could be non accessible.

    I'd prefer option 1.

    ReplyDelete
  5. Hi Dennis,

    My vote for context menu on both list and detail views.
    What about Master detail ones ?

    Regards,
    Marcelo.

    ReplyDelete
    Replies
    1. Hi Marcelo,
      Please clarify your problem with this solution and master detail Views. Thanks.

      Delete
  6. Option 1 and context menu of column header.

    ReplyDelete
  7. Thank you Dennis for the solution provided. Unfortunately, I have a problem when a criteria is set via model (standard model, during developement). In this case, the criteria is not applied again after the reset. It is somehow wrong, because the standard criteria is imposed by the programmer.

    ReplyDelete
    Replies
    1. @Ufo: I could not replicate this behavior using the latest XAF v16.2.4 and its built-in ResetViewSettings Action. If you are already on XAF v15.2.4+, do NOT use the custom Controller mentioned above and instead use the built-in feature. If you experience any difficulties with it, please report the repro steps using the https://www.devexpress.com/Support/Center/Question/Create service. Thanks.

      Delete
    2. Hi Dennis! I'm using v13.1.5 and I can't update version soon, unfortunately. I can submit a ticket for my version, but I suppose v13 is too old to obtain proper support... The solution provided here does almost everything I need, except for the reset of the criteria...

      Delete
    3. (by the way, I don't use an action. Instead, I've modified the contextual menu of the ListView.)

      Delete
    4. Thanks for your clarification. Yes, you are correct that we do not provide a solution for this particular task for such an old version except for the workaround code I posted above, which will also be unable to support due to the availability of a better solution in the most recent XAF versions. For now, I can only recommend you install the latest XAF trial and inspect/grab the source code of the standard ResetViewSettingsController class. Take special note that once you copy its code into your project, you will need to modify/comment out certain features like CustomGetTotalTooltip, CustomGetFormattedConfirmationMessage, etc., which are unavailable in the old XAF versions. Let me know in case of any further difficulties.


      As for the context menu, thanks for informing us of your preferences.

      Delete