Copied to clipboard

Flag this post as spam?

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


  • Sotiris Mastrandrikos 6 posts 26 karma points
    Dec 08, 2017 @ 09:28
    Sotiris Mastrandrikos
    0

    Issues with ng-grid

    Hello,

    I have created a property editor that displays all child nodes using ng-grid.

    the package.manifest:

    {  propertyEditors: [
        { 
            alias: "ContentsGrid",           
            name: "Contents Grid",
            icon: "icon-code",
            group: "Rich Content",
            editor: {
                view: "~/App_Plugins/ContentsGrid/ContentsGrid.html"
            }
        }
    ],
    
    javascript: [
        '~/App_Plugins/ContentsGrid/ng-grid.min.js',
        '~/App_Plugins/ContentsGrid/ContentsGrid.controller.js'
    
    ],
    
    css: [
        '~/App_Plugins/ContentsGrid/ng-grid.min.css'
    ]}
    

    the controller:

    var gridApp = angular.module('umbraco'); gridApp.requires.push('ngGrid'); gridApp.controller("ContentsGridController", function ($scope, editorState, contentResource) {

    $scope.currId = editorState.current.id;
    
    contentResource.getChildren(editorState.current.id).then(function (data) {
        $scope.childNodes = data.items;
        //console.log(JSON.stringify($scope.childNodes));
    
    });
    
    $scope.columnDefs = [
       { field: 'id', displayName: 'ID' },
       { field: 'name', displayName: 'Name' }
    ];
    
    $scope.myOptions = {
        columnDefs: 'columnDefs',
        data: 'childNodes'
    };});
    

    the html:

    <div ng-controller="ContentsGridController">
    <div ng-grid="myOptions"></div>
    

    Actually it works without issues when application starts and the first node is clicked. However, after choosing another node console returns an error:

    TypeError: n.swap is not a function at Object.o.getRealWidth (AppPlugins/ContentsGrid/ng-grid.min.js?cdv=1:1) at Object.o.UpdateGridLayout (AppPlugins/ContentsGrid/ng-grid.min.js?cdv=1:1) at Object.o.AssignGridContainers (AppPlugins/ContentsGrid/ng-grid.min.js?cdv=1:1) at AppPlugins/ContentsGrid/ng-grid.min.js?cdv=1:2 at i (umbraco/lib/angular/1.1.5/angular.min.js?cdv=1:79) at umbraco/lib/angular/1.1.5/angular.min.js?cdv=1:80 at Object.$eval (umbraco/lib/angular/1.1.5/angular.min.js?cdv=1:92) at Object.$digest (umbraco/lib/angular/1.1.5/angular.min.js?cdv=1:90) at Object.$apply (umbraco/lib/angular/1.1.5/angular.min.js?cdv=1:92) at j (umbraco/lib/angular/1.1.5/angular.min.js?cdv=1:101) (anonymous) @ umbraco/lib/angular/1.1.5/angular.min.js?cdv=1:63 umbraco/lib/angular/1.1.5/angular.min.js?cdv=1:63 TypeError: Cannot read property 'assignEvents' of undefined at Object.fn (App_Plugins/ContentsGrid/ng-grid.min.js?cdv=1:2) at Object.$digest (umbraco/lib/angular/1.1.5/angular.min.js?cdv=1:90) at Object.$apply (umbraco/lib/angular/1.1.5/angular.min.js?cdv=1:92) at j (umbraco/lib/angular/1.1.5/angular.min.js?cdv=1:101) at r (umbraco/lib/angular/1.1.5/angular.min.js?cdv=1:104) at XMLHttpRequest.w.onreadystatechange (umbraco/lib/angular/1.1.5/angular.min.js?cdv=1:106)

    any help would be appreciated!

    Thanks in advance

  • Alex Skrypnyk 5908 posts 22603 karma points MVP 4x admin c-trib
    Dec 08, 2017 @ 14:24
    Alex Skrypnyk
    0

    Hi Sotiris

    It looks like 'ng-grid' library isn't compatible with Umbraco backend, can you check that ng-grid is working with angular version that is in Umbraco backend?

    Thanks,

    Alex

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies