Views: 202
Number of votes: 1
Average rating:

DnD support for PropertyList<T>

Hi all,

As you might know then PropertyList<T> is very powerfull. It is help us to easy to manage and organize a list of complex property data but the limitation as I am facing with is that it is not official support sorting via drag and drop (or atleast I don't know how to turn it on - although take hour to googling).

Drag and drop not working on product | Episerver Developer Commun

Then I digged a bit with javascript solution as below then its worked: (I am assumming that you already know about how to create your module via module.config, create your custom editor and map it to your property list property)

So here is our code: SortableCollectionEditor.js

    // dojo

    // EPi Framework

    // epi cms

    // epi commerce
    function (

        // EPi Framework

        // epi cms

        // epi commerce
    ) {
        return declare([CollectionEditor, _GridWithDropContainerMixin, _FocusableMixin], {
            // module:
            //      app/editors/sortablecollectioneditor
            // summary:
            //      Editor widget for support propertylist dnd 

            resources: { "drophere": "You can drop {content} here", "actions": { "content": "content" } },

            postMixInProperties: function () {
                // summary:
                //      Post mix in properties initialization.
                // description:
                //      Fullfills properties that needed to start up the widget.
                // tags:
                //      protected


                this.gridSettings.dndParams = lang.mixin(this.gridSettings.dndParams, {
                    _checkAcceptanceForItems: function (items, acceptedTypes) {
                        var types =, function (item) {

                        var flag = false;
                        for (var j = 0; j < types.length; ++j) {
                            if (types[j] in acceptedTypes) {
                                flag = !!acceptedTypes[types[j]];
                        return flag;

Hope that help!

Ha Bui

Jun 10, 2021

Scott Reed
( By Scott Reed, 6/10/2021 8:23:01 AM)

Is this just because the modal background is greyed out? I did a blog about something similar a while ago using CSS

Ha Bui
( By Ha Bui, 6/10/2021 8:29:35 AM)

Hi Scott, actually the default one CollectionEditor (epi-cms/contentediting/editors/CollectionEditor) did not support this.

Scott Reed
( By Scott Reed, 6/10/2021 8:32:08 AM)

Hmmmn, strange I know when I posted the blog and removed the CSS overlay I could drag and drop blocks/media and such in the PropertyList at least at the time of writing

Ha Bui
( By Ha Bui, 6/10/2021 8:35:32 AM)

Ah, it is different, my workaround is for change item sort order inside the list (using DnD instead of move up/down, very anoying when you have a long list)

And by the way, I'm talking about generic one (CollectionEditor) but not CommerceMediaCollectionEditor.

Scott Reed
( By Scott Reed, 6/10/2021 9:41:08 AM)

Yes I'm just referring to a PropertyList not anything commerce. Okay I see, sort order, I thought you meant drag and drop as in from other panes. My bad :p

Please login to comment.