Copied to clipboard

Flag this post as spam?

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


  • Ismail Mayat 4511 posts 10090 karma points MVP 2x admin c-trib
    Nov 27, 2015 @ 09:29
    Ismail Mayat
    0

    editor state id or parentid incorrect value

    Guys,

    Using this awesome package however having a little weird issue. So I have a property editor custom one that populates a drop down. All works fine when property is added to a doctype.

    I have created a new doctype and added same property and enabled use of that doctype in the grid. When you try adding content the following js code in the controller does something strange:

    // Use the current page id. If the current page is a new page
    // then use it's parent id
    var id = editorState.current.id > 0 ? editorState.current.id : editorState.current.parentId;
    

    Then further down we have

     $http.get("backoffice/ProductSelector/ProductSelectorApi/GetProducts/?currentPage=" + id).then(function (response) {
        $scope.brand = response.data.brand;
        $scope.products = response.data.products;
    });
    

    The weird thing is when this property is used in grid the first line always returns -20 stepping through with chrome debugger editorState.current.id is always 0 and hence it tries to get parentId that returns -20

    Any ideas? This is with umbraco 7.2.8

    Cheers

    Ismail

  • Ismail Mayat 4511 posts 10090 karma points MVP 2x admin c-trib
    Nov 27, 2015 @ 09:31
    Ismail Mayat
    0

    So after speaking to Matt looks like at this point the editorstate is being set a node that does not exist, doctype grid editor uses doc type to define what we will use in the grid but we never create content using it hence it has no value.

    So question now is in my controller is possible in another way to get the node id of the current page?

    Regards

    Ismail

  • Ismail Mayat 4511 posts 10090 karma points MVP 2x admin c-trib
    Nov 27, 2015 @ 10:10
    Ismail Mayat
    0

    In in answer to my own question i have a work around,

    if (id === -20) {
        //we are grid and working with virtual node hence we have no id as we have no node
        //hence get id from query string
        var url = window.location.href;
        var urlArray = url.split('/');
        id = urlArray.slice(-1)[0];
    }
    

    Also Matt has raised issue on issue tracker http://issues.umbraco.org/issue/U4-7466

    Regards

    Ismail

Please Sign in or register to post replies

Write your reply to:

Draft