Giter VIP home page Giter VIP logo

Comments (8)

danomatic avatar danomatic commented on May 24, 2024

That's because both instances are bound to the same references to JavaScript objects. I consider this to be a desired behavior.

from angular-gridster.

jdewit avatar jdewit commented on May 24, 2024

Can you explain the issue a little more thoroughly. I don't get what you mean.

from angular-gridster.

danomatic avatar danomatic commented on May 24, 2024

In the angular version of gridster, we are binding javascript elements in the scope to the gridster item. Due to the two-way binding of the data between the data and and directive elements, a change to the position value for a item in one gridster instance will be reflected in other gridster instances that reference the same item.

from angular-gridster.

jdewit avatar jdewit commented on May 24, 2024

Gotcha.

@ptsydzik How did you reproduce this in the demo? The two dashboards do not use the same widgets.

Also, what's your use case? Why have duplicate grids with the same items?

from angular-gridster.

danomatic avatar danomatic commented on May 24, 2024

Custom Items, and Custom Items 2 use the same scope items.

from angular-gridster.

ptsydzik-zz avatar ptsydzik-zz commented on May 24, 2024

sorry for my english. @danomatic is a good telepathist :)
my case i have 3 gidsters on the same page: 1 - list of all available widgets and 2 - active widgets splitted by criteria i use it like this:

$scope.availableWidgets = [....]
$scope.widgets = {
            criteria1: [....],
            criteria2: [...]
        };

angular.forEach($scope.availableWidgets, function(widget, index) {
        widget = angular.extend({}, widget, { sizeX: 1, sizeY: 1, row: index, col: 0 });
    });

angular.forEach($scope.widgets.singleColumn, function(widget, index) {
            widget = angular.extend({}, widget, { sizeX: 1, sizeY: 1, row: index, col: 0 });
        });

        angular.forEach($scope.widgets.dabbleColumn, function(widget, index) {
            widget = angular.extend({}, widget, { sizeX: 1, sizeY: 1, row: index, col: 0 });
        });

from angular-gridster.

danomatic avatar danomatic commented on May 24, 2024

Where are $scope.widgets.singleColumn and $scope.widgets.dabbleColumn defined and are they pointing to the same item objects as $scope.availableWidgets? The widget = angular.extend({}... you are doing seems like it would have no effect, because you are just altering the value of widget in the loop and not replacing the reference in the original arrays with the new copy.

from angular-gridster.

TheBosZ avatar TheBosZ commented on May 24, 2024

ptsydzik, are you still having problems or can I close this issue?

from angular-gridster.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.