Search This Blog

Showing posts with label sorting. Show all posts
Showing posts with label sorting. Show all posts

Wednesday, March 29, 2017

Improving UX with Grid List Editors by disabling ALL unsupported operations for non-persistent columns in server modes (XAF v16.2.6) - YOUR FEEDBACK IS NEEDED!

In server modes, grid controls perform operations like sorting, grouping, filtering, etc. on the data store side to guarantee the best performance. Thus, columns bound to non-persistent properties (their values exist only in the client memory at runtime) cannot be used for such server-based operations and can cause exceptions (learn more...). Some of them can be detected only in the end application after navigating to a problematic grid at runtime.


With XAF 16.2.6, to prevent these situations, we have improved column creation logic in our Grid List Editors for Windows and the Web. In particular, we have disabled all server-based operations (sorting, filtering, grouping) for non-persistent properties in the ASP.NET WebForms ASPxGridListEditor and WinForms GridListEditor when DataAccessMode = Server or InstantFeedback. 

Technically, it means the following:
    1) The grid's Find Panel does not take non-persistent properties into account.
    2) The grid's Filter Editor does not display non-persistent properties in the properties tree.
    3) The grid's Auto Filter Row feature is not available for non-persistent columns.
    4) Grid column headers for non-persistent columns do not allow end-users to filter, sort, group.


See this video recorded from the WinForms version of our MainDemo:


Take special note that in XPO, calculated non-persistent properties defined using PersistentAliasAttribute or CalculatedAttribute can still be used without problems for server-based operations as previously. The only PersistentAlias attribute scenario, which may still not lead to disabled server-side operations, is when you have an aliased reference property and a grid column with a complex property path like:
YourPersistentAliasReferenceProperty.SomeNestedProperty1.SomeNestedPropertyN.
Such properties will be treated as regular non-persistent properties for now or you can disable our improvement using the feature toggle below.
For EF, calculated properties defined using CalculatedAttribute are still unsupported and treated as regular non-persistent properties mentioned above.

I do not need this behavior. How do I disable it?
With v16.2.7 (or, after installing this hot fix), you can set the PreventServerSideOperationsForNonPersistentMembers property of the DevExpress.ExpressApp.Editors > ColumnsListEditor  class to False in the overridden OnActivated method of a custom ViewController for a required ListView. Refer to the following example:

[C#]
using DevExpress.ExpressApp; using DevExpress.ExpressApp.Editors; namespace MainDemo.Module.Controllers { public class S31714_FeatureToggle : ViewController<ListView> { protected override void OnActivated() { base.OnActivated(); ColumnsListEditor columnsListEditor = View.Editor as ColumnsListEditor; if(columnsListEditor != null) { columnsListEditor.PreventServerSideOperationsForNonPersistentMembers = false; } } } }
[VB.NET]
Imports DevExpress.ExpressApp Imports DevExpress.ExpressApp.Editors Namespace MainDemo.Module.Controllers Public Class S31714_FeatureToggle Inherits ViewController(Of ListView) Protected Overrides Sub OnActivated() MyBase.OnActivated() Dim columnsListEditor As ColumnsListEditor = TryCast(View.Editor, ColumnsListEditor) If columnsListEditor IsNot Nothing Then columnsListEditor.PreventServerSideOperationsForNonPersistentMembers = False End If End Sub End Class End Namespace

Friday, May 3, 2013

ListView CollectionSource improvements with regard to sorting



I think you will be pleased to know that in the upcoming 13.1 version we have made several refactorings of  the core parts of our framework that allowed us to implement a few features requested by our customers:

Core - Provide sorting capabilities to the CollectionSourceBase class
Core - Support ListView sorting settings from the application model in Server Mode
Core - Pass sorting options from the application model into PropertyCollectionSource

Now, when you add/remove the CollectionSourceBase.Sorting list items, sorting is immediately applied to the inner collection. Do not add several elements one after another. Instead, populate a temporary SortProperty list and then assign it to CollectionSourceBase.Sorting. The example below is taken from the ListView.LoadModelCore method implementation.
 
[C#]
List<SortProperty> sorting = new List<SortProperty>(); foreach(IModelSortProperty sortProperty in Model.Sorting) { sorting.Add(new SortProperty(sortProperty.PropertyName, sortProperty.Direction)); } collectionSource.Sorting = sorting;
In this instance, all SortProperty items will be applied simultaneously.

We have also added the CollectionSourceBase.CanApplySorting property. When it is set to true, sorting options specified in the application model are applied. In the CollectionSource descendant, the default value of this property is true. Take special note that in the PropertyCollectionSource descendant the default value is false. This is done to avoid accidental overriding of sorting specified in a collection property getter.