Skip to content

Commit

Permalink
Huge improvements in the way arrays are handled, everything works now…
Browse files Browse the repository at this point in the history
… as far as I know
  • Loading branch information
David-Mulder committed Nov 13, 2015
1 parent 082af9c commit 4f2dc60
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions leather-editable-list.html
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@
_recheckChecked: {
type: Number,
computed: '_getRecheckChecked(items.splices)'
},
_debugPath: Array
}
},

behaviors: [
Expand Down Expand Up @@ -159,7 +158,8 @@
if(item.hasAttribute('data-empty')){
item.removeAttribute('data-empty');
var instance = this.stamp({value: item.dataItem});
instance.i = i;
instance.collectionKey = Polymer.Collection.get(this.items).getKey(item.dataItem);
item.setAttribute('data-collection-key', instance.collectionKey);
item.appendChild(instance.root);
item.instance = instance;
}
Expand All @@ -169,10 +169,11 @@

_notifyPathOnInstances: function(change){
var path = change.path.split('.');
console.group('Observer triggered on items.*, the path is', path);
console.info('change:', change);
console.info('items:', this.items);
console.groupEnd();
if(path.length >= 2 && path[1].substr(0,1) == '#'){
var value = this.get('items.'+path[1]);
var instance = Polymer.dom(this.root).querySelector('.row .item[data-collection-key="'+path[1]+'"]').instance;
instance.set('value', value);
}
},

_isChecked: function(item, id){
Expand Down Expand Up @@ -220,14 +221,14 @@
_forwardInstanceProp: function(templateInstance, prop, value){
var path = prop.split('.');
var item = path.shift();
var forwardPath = ['items', '#'+templateInstance.i].join('.');
var forwardPath = ['items', templateInstance.collectionKey].join('.');
this.set(forwardPath, value);
//console.info('_forwardInstanceProp',arguments, templateInstance.i);
},
_forwardInstancePath: function(templateInstance, prop, value){
var path = prop.split('.');
var item = path.shift();
var forwardPath = ['items', '#'+templateInstance.i].concat(path).join('.');
var forwardPath = ['items', templateInstance.collectionKey].concat(path).join('.');
this.set(forwardPath, value);
//console.info('_forwardInstancePath',arguments, templateInstance.i);
},
Expand Down

0 comments on commit 4f2dc60

Please sign in to comment.