Copied to clipboard

Flag this post as spam?

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


  • Nigel Wilson 944 posts 2076 karma points
    Aug 09, 2017 @ 03:18
    Nigel Wilson
    0

    Hi there

    I am trying to create a custom editor for Grid. I simply want 3 textfields for a user to enter data and I will render out a button based on the 3 fields.

    As a starting point, I have worked through the following but for the life of me cannot get things working.

    https://our.umbraco.org/documentation/getting-started/backoffice/property-editors/built-in-property-editors/Grid-Layout/build-your-own-editor

    The custom editor is showing up in the grid data type, and also is available in the content section as a content option.

    The problem I am having is once selected, the panel on the right does not appear to be able to enter the data in the field(s).

    package,manifest

        {
      "gridEditors": [
        {
          "name": "Button",
          "alias": "ButtonEditor",
          "view": "/App_Plugins/Grid/Editors/Views/ButtonEditor.html",
          "render": "/App_Plugins/Grid/Editors/Render/ButtonEditor.cshtml",
          "icon": "icon-settings-alt"
        }
      ],
    //array of files we want to inject into the application on app_start
      "javascript": [
        "/App_Plugins/Grid/Editors/Controllers/ButtonEditor.Controller.js"
      ]
    }
    

    HTML View

    <div ng-controller="my.custom.grideditorcontroller">
        <textarea rows="1" ng-model="control.value" ng-style="control.config"></textarea>
    </div>
    

    CSHTML Partial

    @inherits Umbraco.Web.Mvc.UmbracoViewPage<dynamic>
    <pre>@Model.value</pre>
    

    Controller

    angular.module("umbraco").controller("my.custom.grideditorcontroller", function ($scope) {
        $scope.control.value = "my new value";
    });
    

    Can anyone please enlighten me - I have created custom editors before, however cannot get this working - so so so frustrating.

    What am I doing wrong ?

    Thanks, Nigel

  • Nigel Wilson 944 posts 2076 karma points
    Aug 09, 2017 @ 23:00
    Nigel Wilson
    0

    Have just found this wee gem which is 90% of what I was wanting to achieve, AND it works.

    https://github.com/hemraker/grid-cta-button

    Time to throw away my code and modify the above code to do what I am wanting.

    Nigel

  • Rune Hem Strand 147 posts 911 karma points hq c-trib
    Aug 10, 2017 @ 09:57
    Rune Hem Strand
    100

    Hi Nigel

    Happy to hear you can make use of it!

    If you make any changes that could benefit others you're more than welcome to submit a PR or if you find any issues, raise them on the project issues page.

    h5yr

    /Rune

Please Sign in or register to post replies

Write your reply to:

Draft