IModelSorting Interface
The Sorting node provides access to the sort settings applied to the collection of the List View‘s Collection Source.
Namespace: DevExpress.ExpressApp.Model
Assembly: DevExpress.ExpressApp.v18.1.dll
Declaration
public interface IModelSorting :
IModelNode,
IModelList<IModelSortProperty>,
IList<IModelSortProperty>,
ICollection<IModelSortProperty>,
IEnumerable<IModelSortProperty>,
IEnumerable
Related API Members
The following members return IModelSorting objects:
Remarks
This interface is a part of the Application Model infrastructure and isn’t intended to be implemented by your classes.
Important
Sorting, specified via the IModelSorting node is applied to the underlying data source. It may be overridden by sorting specified for the bound control (see IModelColumn.SortOrder).
The IModelSorting node represents a list of the IModelSortProperty nodes. You can add SortProperty child nodes to specify sorting applied to the collection of the List View’s Collection Source. For instance, this setting has effect when the IModelListView.TopReturnedObjects property is specified. An example is available in the XCRM demo (see the Views | ITop5Customers_ListView node). This demo is located in the %PUBLIC%\Documents\DevExpress Demos 18.1\Components\eXpressApp Framework\XCRM folder, by default.
By default, settings specified via the IModelSorting node have no effect in nested List Views where the PropertyCollectionSource is used. In the PropertyCollectionSource class, the CollectionSourceBase.CanApplySorting default value is false, to avoid accidental overriding of the sorting specified in a collection property getter. To change the CanApplySorting value to true, use the following View Controller:
using DevExpress.ExpressApp;
// ...
public class MyViewController : ViewController<ListView> {
public MyViewController() {
this.TargetObjectType = typeof(MyBusinessObject);
this.TargetViewNesting = DevExpress.ExpressApp.Nesting.Nested;
}
protected override void OnActivated() {
base.OnActivated();
this.View.CollectionSource.CanApplySorting = true;
}
}