Sorting binded documents in Composed Form Model

hi, we have the same problem as discussed in Sorting binded documents but in current Version 2025.06-ext4:

As we already clarified in the related topic, Sorting of “Selected Itemes Overview” in a composed FormModel is only possible in Frontend client. This is documented here: GetA12

I’ve copied that code and here is the complete source:

import { call, SagaGenerator } from 'typed-redux-saga';

import { DataOperation, maybeAsyncFnWrapper, OverviewEngineDataLoader } from '@com.mgmtp.a12.overviewengine/overviewengine-core';
import { Query } from '@com.mgmtp.a12.dataservices/dataservices-access';
import { OverviewEngineFactories } from '@com.mgmtp.a12.overviewengine/overviewengine-core/lib/main/client-extensions';

export const CustomOvDataLoader: OverviewEngineDataLoader = {
    *provideData(params): SagaGenerator<DataOperation.ResultSet> {
        const { queries, documentModel } = params;
        const [query, ...otherQueries] = queries;
        let updatedQuery = query;

        if (DataOperation.ListDocuments.Query.isAssignableFrom(query) && documentModel.header.id === "Beleg_DM") {
            updatedQuery = {
                ...query,
                sort: [
                    {
                        field: "/Beleg/LaufendeNummer",
                        direction: Query.Direction.ASC,
                        ignoreCase: false,
                        nullHandling: Query.NullHandling.NULLS_LAST
                    }
                ]
            };
        }

        // eslint-disable-next-line @typescript-eslint/ban-ts-comment
        // @ts-ignore
        return yield* call(maybeAsyncFnWrapper(OverviewEngineFactories.dataLoader.provideData), {
            ...params,
            queries: [updatedQuery, ...otherQueries]
        });
    }
};

but now we’re struggling on integration in appsetup.ts. Tried it like this GetA12 and as follows, but we are not able to integrate that DataLoader for OverviewEngine:

export function setup(): {
    config: ApplicationSetup;
    initialStoreActions(): Promise<void>;
} {
    const dataHandlers: DataHandler[] = [
        createCddDataProvider(),
        createEmptyDocumentDataProvider(),
        RelationshipFactories.createRelationshipDataProvider(),
        ...OverviewEngineFactories.createDataProviders({ dataLoader: CustomOvDataLoader }),
        platformSingleDocumentDataProvider
    ];

What would be the right way? Could You please provide a working code snippet?

I’ve read about sample code for 2024.06 but unable to find it.

Best Regards, Gunther

Hi @gunther-stable-thorn,

the sample code (or example) from which I was talking about in this post is available in the ticket A12-16010. Since I assume that you don’t have access to the ticket, I will copy the relevant part in this thread:


The customization option has already been avaiable via an API called “componentProvider”, the API itself is already a public interface and can be imported by anyone. However, the current implementation of Relationship Engine doesn’t allow an “simple” way to register and override certain component like “DualPane” or “TableList” components. Therefore, the design of solution will be aimed to exposing it as minimal as possible so that the project won’t experience unintended breaking changes causing by the “experiemental” CDM.

Instead of

const CustomFormModelMap: FormModelMap = {
	...DefaultFormModelMap,
        ...DefaultRelationshipFormModelMap,
}

The FormModelMap now can be registered via createRelationshipFormModelMap with an optional “componentProvider”

const CustomFormModelMap: FormModelMap = {
	...DefaultFormModelMap,
	...createRelationshipFormModelMap({
		componentProvider: config => {
			if (config.name === "DualPaneSelection") {
				return { type: "MultiSelection", component: CustomDualPane };
			}
			return undefined;
		}
	})
}; 

This allows CustomDualPane or TableList to be override-able and provided a new list with custom sorting.


Regading to your question:

I will refer to @nam-secure-mesa’s answer:


Even your implementation is right, I realized (and I am really sorry for this confusion) that it won’t work for your Composed Form. The way to go for your case is what I described in other post (even for a initial static sorting).

I implemented a working A12 application with the sorting in a Data Binding component based on the project template 2025.06-ext2. I attached the following files:
customFormEngine.tsx.txt (2.4 KB) : new file which you can place in e.g. ‘client/src/formEngine/’. It is the needed customization of the DualPanel and TableList.
viewProvider.tsx.txt (2.6 KB) : The adapted version of the viewProvider.

Apart from those files, I did not have to change anything else.

Thank You for Your help.

May be because of our complicated CFM/CDM we had trouble with that solution, so a colleage implemented the sort by a middleware on cdd/MERGE.

Regards, Gunther