Skip to content
apobekiaris edited this page Jul 26, 2020 · 9 revisions

GitHub issues GitHub close issues

About

The PositionInListView, controls how objects are positioned in a ListView at runtime.

Details


Credits: to the Company (wants anonymity) that sponsor the initial implementation of this module.


This is a platform agnostic module that is designed to sort a ListView based on a existing Business Object member. It is possible to define one configuration for each ListView and choose the sorting member from the model as shown:

image

For the configured ListViews the MoveObjectUp and MoveObjectDown actions will be active and they can be used to change the order. The module on the background swaps the values of the model configured PositionMember on each action execute resulting in a persistent ListView order.

The ListView sorting happens when a ListView is created on the CollectionSource object. For cases that the CollectionSource is not sortable e.g. (non-persistent) sorting is done explicitly. In addition ListView sorting and grouping from the UI Editor are disabled and the PositionMember modification are not committed explicitly.

For new Business objects the module will automatically update the configured members as per model configuration as shown:

image

If a NewObjectsStrategy for the ModelClass is not configured it defaults to Last. The strategy is not applied to objects created from a ModuleUpdater.

In the screencast we create three customers at runtime and demo the feature by executing the MoveUp/MoveDown actions and close/reopen the view`. At the bottom the Reactive.Logger.Client.Win

sqFoseHS2q

image


Possible future improvements:

  1. Moving multiple positions at once.
  2. Moving multiple objects.
  3. Conditional NewObjectsStrategy.
  4. Conditional persistance PositionMember modifications.
  5. Enable temporarily UI sorting and grouping on the ListView.
  6. Any other need you may have.

Let me know if you want me to implement them for you.


Installation

  1. First you need the nuget package so issue this command to the VS Nuget package console

    Install-Package Xpand.XAF.Modules.PositionInListView.

    The above only references the dependencies and next steps are mandatory.

  2. Ways to Register a Module or simply add the next call to your module constructor

    RequiredModuleTypes.Add(typeof(Xpand.XAF.Modules.PositionInListViewModule));

Versioning

The module is not bound to DevExpress versioning, which means you can use the latest version with your old DevExpress projects Read more.

The module follows the Nuget Version Basics.

Dependencies

.NetFramework: net461

DevExpress.ExpressApp Any
Fasterflect.Xpand 2.0.7
JetBrains.Annotations 2019.1.3
System.ValueTuple 4.5.0
Xpand.Extensions 2.201.29
Xpand.Extensions.XAF 2.201.29
Xpand.VersionConverter 2.201.7

Issues-Debugging-Troubleshooting

To Step in the source code you need to enable Source Server support in your Visual Studio/Tools/Options/Debugging/Enable Source Server Support. See also How to boost your DevExpress Debugging Experience.

If the package is installed in a way that you do not have access to uninstall it, then you can unload it with the next call at the constructor of your module.

Xpand.XAF.Modules.Reactive.ReactiveModuleBase.Unload(typeof(Xpand.XAF.Modules.PositionInListView.PositionInListViewModule))

Tests

The module is tested on Azure for each build with these tests. All Tests run as per our Compatibility Matrix

image

image


Custom badge

Star the project if you think it deserves it.

GitHub stars

Fork the project to extend and contribute.

GitHub forks

Clone this wiki locally