Comments (3)
I have not tested it yet. The deckgrid will be rendered again if the object count of the source collection has changed. Any other change reflects without a re-rendering. So my guess is that it will work. Let me know if you've tried it :)
from angular-deckgrid.
Am I wrong in thinking that this function won't trigger if the array order changes?
Deckgrid.prototype.$$onModelChange = function $$onModelChange (oldModel, newModel) {
var self = this;
if (oldModel.length !== newModel.length) {
self.$$createColumns();
}
};
Have you considered using angular.equals instead?
if (!angular.equals(oldModel, newModel){
self.$$createColumns();
}
It seems to work well for me
from angular-deckgrid.
Well, it's complicated. :) Consider the scenario that you have a lot of objects in your deckgrid (which was my use case while developing the directive). When using the angular.equals
method, changing one property of an object in the source collection means triggering the whole grid rendering again. An use case that works fine for small collections or not many object property changes.
One option could be to integrate a "strict mode", like:
deckgrid-strict="true" => !angular.equals(oldModel, newModel)
deckgrid-strict="false" (default) => oldModel.length !== newModel.length
Another option would be to use angular.extend
within your code (if you have a source collection in which every object has the same property structure). This is useful if you want to switch positions without losing references.
Let me know what you think.
from angular-deckgrid.
Related Issues (20)
- Error on safari
- regex for checking deckgrid styles does not work in IE9
- Virtual Scroll HOT 2
- number of columns
- Edge issue with class(es) on [deckgrid] HOT 2
- Any plan for Angular2? HOT 1
- Initial Setup
- after adding more data to source, how to notify the layout? HOT 1
- Nested transclude broken HOT 2
- OrderBy
- How can I use angular-deckgrid with the latest angularjs version?
- .
- Supporting differing templates based on condition
- shortcut mother.* doesn't work
- give index when card select
- Dynamic columns HOT 2
- Submit to npmjs.com! HOT 9
- Scroll down to load more
- Module Loader Support
- Dynamically changing the number of columns HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular-deckgrid.