Copied to clipboard

Flag this post as spam?

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


  • Simon Dingley 1414 posts 3291 karma points c-trib
    Feb 15, 2019 @ 15:54
    Simon Dingley
    0

    Adding the Doctype Name to the Grid Editor When Grid Items are Sorted

    Thanks guys for yet another great extension, something that again should hopefully make it it into the core one day!

    When an editor attempts to sort the items in a grid there is no way to distinguish between one DoctypeGridEditor and another, see the following example:

    enter image description here

    Is it possible to append the Doctype name to grid editor name?

    So, in the example above, the Grid Editor is called Content Block but when sorting it would be useful to say Content Block - Doctype Name.

    Disclaimer: I'm not a big fan of using the Umbraco Grid editor for reasons I won't go into here (nothing to do with the controls but the editors) so due to my lack of use I may be missing something obvious?

  • Lee Kelleher 3928 posts 15072 karma points MVP 10x admin c-trib
    Feb 15, 2019 @ 16:04
    Lee Kelleher
    1

    Hi Simon,

    Someone else asked for this a while back, we looked into it - cutting a long story short, the labels used when sort mode is displayed is handled by the Grid, it uses the "name" that you have for the grid-editor in the grid.editors.config.js. (It's beyond DTGE's control).

    For longer technical details (including hacks), read the ticket on GitHub: https://github.com/umco/umbraco-doc-type-grid-editor/issues/116

    Cheers,
    - Lee

  • Simon Dingley 1414 posts 3291 karma points c-trib
    Feb 15, 2019 @ 16:35
    Simon Dingley
    0

    the labels used when sort mode is displayed is handled by the Grid, it uses the "name" that you have for the grid-editor in the grid.editors.config.js. (It's beyond DTGE's control).

    I thought as much :(

    For longer technical details (including hacks), read the ticket on GitHub: https://github.com/umco/umbraco-doc-type-grid-editor/issues/116

    Thanks for the link looks like there could be something useful in there so will see what I can do.

    Cheers Lee!

  • Chris Evans 122 posts 313 karma points c-trib
    Aug 21, 2019 @ 02:13
    Chris Evans
    0

    We have this same issue - however this link https://github.com/umco/umbraco-doc-type-grid-editor/issues/116 now returns a 404, is there any way to post the useful information here, or somewhere else we could access it?

  • jake williamson 171 posts 761 karma points
    Aug 21, 2019 @ 02:18
    jake williamson
    0

    you beat me to it chris, i was just writing the same thing!

    we've this issue in a new editor we're working for in v8. there's loads of rows on the page and it's a nightmare to sort as you've got to remember the item position...

    the git hub issue was suggesting using js to change the row title. i did managed to get it almost working using this code in a directive:

    $timeout(function () {
      //it'd be great to be able to change the title of the grid wrapper as it would make it so much better for sorting
      //only problem is, i can't get 'umb-control-title' as when the page loads the element doesnt exist...
      //it only seems to come in to play when you click the block
      angular.element(document).ready(function () {
        var controlInner = element.closest(".umb-control-inner");
        var controlBar = controlInner.find(".umb-control-bar");
        var controlTitle = controlBar.find(".umb-control-title");
        controlTitle.text(scope.name);
      });
    }, 0);
    

    weirdly though, i can get at controlInner and i can get controlBar but controlTitle always returns null...

    i think it's got something to do with the angular not making the controlTitle available until you reorder?

    might give you a starting point though ;)

  • Chris Evans 122 posts 313 karma points c-trib
    Aug 21, 2019 @ 02:37
    Chris Evans
    0

    I found the original link, has moved to the new github repo for the v8 version of DTGE.

    https://github.com/skttl/umbraco-doc-type-grid-editor/issues/116

    It mostly talks about how to hack the javascript to achieve the result, which is something we wouldn't want to do (as we'd prefer to have support and upgrade ability to future releases intact rather than having a custom version).

    It does also mention this:

    "My advice is to separate out the grid config entries for each of your doctypes. I know this means you will lose your groupings, but it gives you more control over the naming."

    Is there an example somewhere of how to do this? The documentation we have here https://github.com/skttl/umbraco-doc-type-grid-editor/blob/master/docs/developers-guide.md is excellent but doesn't explain exactly how the config\grid.editors.config.js file and the App_Plugins\DocTypeGridEditor\package.manifest interact - as in, which one takes precedence and which one you should use.

    We have used the package.manifest option as that is the one documented and seems appropriate, but there is no example of how to add multiple items to the gridEditors array. When we try this, none of the options appear when you go to select your doctype editor in the grid.

  • Søren Kottal 501 posts 3331 karma points MVP 2x c-trib
    Aug 21, 2019 @ 07:12
    Søren Kottal
    0

    Hi Chris

    I usually add a package.manifest per grid editor. I feel it is easier to manage in git (especially when having multiple devs adding their own editors).

    The other way, is to "just" add multiple objects in the gridEditors array of your grid.editors.config.js, or the package.manifest.

    {
      "gridEditors": [
        {
          "name": "Banner",
          "alias": "banner",
          "view": "/App_Plugins/DocTypeGridEditor/Views/doctypegrideditor.html",
          "render": "/App_Plugins/DocTypeGridEditor/Render/DocTypeGridEditor.cshtml",
          "icon": "icon-banner",
          "config": {
            "allowedDocTypes": ['banner'],
            "nameTemplate": "",
            "enablePreview": false,
            "viewPath": "/Views/Partials/Grid/Editors/DocTypeGridEditor/",
            "previewViewPath": "/Views/Partials/Grid/Editors/DocTypeGridEditor/Previews/",
            "previewCssFilePath": "",
            "previewJsFilePath": ""
          }
        },
        {
          "name": "Picture",
          "alias": "picture",
          "view": "/App_Plugins/DocTypeGridEditor/Views/doctypegrideditor.html",
          "render": "/App_Plugins/DocTypeGridEditor/Render/DocTypeGridEditor.cshtml",
          "icon": "icon-media",
          "config": {
            "allowedDocTypes": ['picture'],
            "nameTemplate": "",
            "enablePreview": false,
            "viewPath": "/Views/Partials/Grid/Editors/DocTypeGridEditor/",
            "previewViewPath": "/Views/Partials/Grid/Editors/DocTypeGridEditor/Previews/",
            "previewCssFilePath": "",
            "previewJsFilePath": ""
          }
        },
        {
          "name": "Text Area",
          "alias": "textArea",
          "view": "/App_Plugins/DocTypeGridEditor/Views/doctypegrideditor.html",
          "render": "/App_Plugins/DocTypeGridEditor/Render/DocTypeGridEditor.cshtml",
          "icon": "icon-article",
          "config": {
            "allowedDocTypes": ['textArea'],
            "nameTemplate": "",
            "enablePreview": false,
            "viewPath": "/Views/Partials/Grid/Editors/DocTypeGridEditor/",
            "previewViewPath": "/Views/Partials/Grid/Editors/DocTypeGridEditor/Previews/",
            "previewCssFilePath": "",
            "previewJsFilePath": ""
          }
        }
      ]
    }
    

    Also, I am working on packaging this little nugget up, to make it easier to manage your DTGEs (video in link)

    https://twitter.com/i/status/934006545561653248

Please Sign in or register to post replies

Write your reply to:

Draft