Giter Site home page Giter Site logo

Comments (4)

orneryd avatar orneryd commented on June 15, 2024

Okay, so I think I finally have it now. watching Arrays is hard! I basically have two watchers, one for the array length, the other for the array reassignment. If the length watcher gets fired and the length is different from the previous length (saved from either path) the actual watcher code gets fired. I have to do this because you could have an array length of 5, and reassign an array length of 10 and both watcher functions would get called. this way it only gets fired once per push/pop/reassign.

splice is not fully supported. If you have to splice the array you will want to copy and reassign after splicing is done... splicing is weird....

from ui-grid.

orneryd avatar orneryd commented on June 15, 2024

but it's fixed in the latest build.

from ui-grid.

robertjchristian avatar robertjchristian commented on June 15, 2024

I am experiencing this issue. I change the model with ui-sortable, which reorders the underlying array of elements within the grid, but does not create a push/pop ... I've been pulling my hair out actually. Assumed ng-grid watched for any change?

from ui-grid.

robertjchristian avatar robertjchristian commented on June 15, 2024

I am trying reassignment as well. I hook into sortable options and on update(), call a reassign method on the model (as a workaround)

reassign: function() {
console.log("Copying art JSON for reassignment in order to trigger update to ng-grid - remove when ng-grid bug is fixed");
var copy = JSON.parse(JSON.stringify(foo));
this.foo = copy;
$rootScope.$broadcast( 'FooService.update', this.foo );
}

... that doesn't work either. In fact only thing that works is slice.

from ui-grid.

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.