Skip to content

Commit

Permalink
Fix undefined and default handling
Browse files Browse the repository at this point in the history
  • Loading branch information
David-Mulder committed Oct 25, 2015
1 parent 370bf10 commit 1b16e15
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
9 changes: 8 additions & 1 deletion demo/card.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@
<paper-input value="{{value.last}}" style="display:inline-block;"></paper-input>
</template>
</paper-datatable-column>
<paper-datatable-column property="isAdmin" header="Administrator" default="false">
<template>
<paper-checkbox checked="{{value}}"></paper-checkbox>
</template>
</paper-datatable-column>
</paper-datatable>
</paper-datatable-card>

Expand All @@ -51,7 +56,8 @@
author: {
first: "David",
last: "Mulder "+ id
}
},
isAdmin: (Math.random() > 0.9 ? true : undefined)
});
}

Expand All @@ -70,6 +76,7 @@
});
},
set: function(id, property, value){
console.info("a save was triggered");
var item = myData.find(function(item){
return item.id == id;
});
Expand Down
2 changes: 1 addition & 1 deletion paper-datatable-column.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
console.log(this.config);
},
createCellInstance: function(model, notificationId, notificationProp){
if(typeof model[this.property] == "undefined" && this.default){
if(typeof model[this.property] == "undefined" && typeof this.default !== "undefined"){
var instance = this.stamp({item: model, value: this.default, _dataId: notificationId});
}else{
var instance = this.stamp({item: model, value: model[this.property], _dataId: notificationId});
Expand Down
3 changes: 0 additions & 3 deletions paper-datatable.html
Original file line number Diff line number Diff line change
Expand Up @@ -283,9 +283,6 @@
}
if(cell.instance){
var instancePath = ["item", path.join(".")].join(".");
console.info(cell, "column", instancePath, "to", change.value);
console.info(cell.instance);
console.log(JSON.stringify(cell.instance.__data__));
cell.instance.notifyPath(instancePath, change.value, true);
}

Expand Down

0 comments on commit 1b16e15

Please sign in to comment.