Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • John Sharp 20 posts 110 karma points
    Jan 08, 2021 @ 16:18
    John Sharp
    0

    "This content is not allowed here" prevents reordering

    enter image description here

    I've been trying to reorder some items inside of a grid editor section, when I start to drag an editor this message appears.

    I've dug into the code and found this:

                over: function over(event, ui) {
                var area = event.target.getScope_HackForSortable().area;
                var allowedEditors = area.allowed;
    
    
                /*if (area.$allowedEditors) {
                    allowedEditors = (allowedEditors ?? []).concat(area.$allowedEditors.map(e => e.alias));
                }*/
    
    
                if ($.inArray(ui.item[0].getScope_HackForSortable().control.editor.alias, allowedEditors) < 0 && allowedEditors || startingArea != area && area.maxItems != '' && area.maxItems > 0 && area.maxItems < area.controls.length + 1) {
                    $scope.$apply(function () {
                        area.dropNotAllowed = true;
                    });
                    ui.placeholder.hide();
                    cancelMove = true;
                } else {
                    if (area.controls.length == 0) {
                        $scope.$apply(function () {
                            area.dropOnEmpty = true;
                        });
                        ui.placeholder.hide();
                    } else {
                        ui.placeholder.show();
                    }
                    cancelMove = false;
                }
            },
    

    The commented out block is a change I've made to get around the issue. From what I was able to see, it looks as though area.allowed is being incorrectly set when the grid rows are being edited and the allow all editors flag is toggled. The values of the area object as presented have .$allowedEditors set correctly with all values that are available but .allowed does not.

    I may be wrong and possibly have incorrectly set up the rows of my grid but I can't tell based on the objects.

    My thanks,

    John

  • Nathan Rogan 1 post 71 karma points
    Jan 14, 2021 @ 15:22
    Nathan Rogan
    0

    Also having this issue in 8.9.1

    Workaround: Instead of selecting "Allow all editors" on your grid row configuration, if you manually select the editors it allows you to reorder.

  • Edgar Rasquin 326 posts 925 karma points
    Feb 26, 2021 @ 10:16
    Edgar Rasquin
    0

    Not working for me

  • John Sharp 20 posts 110 karma points
    Feb 26, 2021 @ 10:20
    John Sharp
    0

    Hi Edgar, is it the code above that I posted that isn't working or the workaround?

    If it's the code above, what version are you current using and do you get an error?

  • Edgar Rasquin 326 posts 925 karma points
    Feb 26, 2021 @ 10:24
    Edgar Rasquin
    0

    Sorry John,

    the Workaround "Allow all editors" is not working for me. I have ovelooked your code example. Did not test it. Where did you make these changes?

    Edi

  • John Sharp 20 posts 110 karma points
    Feb 26, 2021 @ 10:29
    John Sharp
    0

    Ah, I see.. the workaround is a possible solution but yes, it's a bit cumbersome if you have many grid editor configurations or lots of property editors...

    The code I've added was directly to the Umbraco source. https://github.com/umbraco/Umbraco-CMS/blob/34e80d86e8c0b754f6b7a02e307f53cb32806bbe/src/Umbraco.Web.UI.Client/src/views/propertyeditors/grid/grid.controller.js

    That's a link to the Github repo. The function I've made changes to is over at line 141, the code I added was into the gap at 145.

    HTH

  • Edgar Rasquin 326 posts 925 karma points
    Feb 26, 2021 @ 10:37
    Edgar Rasquin
    0

    Thanks for sharing. I will give it a try.

    Have a nice day

  • John Sharp 20 posts 110 karma points
    Jan 25, 2021 @ 15:16
    John Sharp
    0

    True, that is a valid workaround. In this instance I'm working with a solution that has many grid configurations and property editors. While the solution is a valid one it's overly cumbersome and time consuming to retrospectively add each new property editor to each row.

Please Sign in or register to post replies

Write your reply to:

Draft