From 65cc5b35cc7bfdae937b5d682d655bf0aa76bd53 Mon Sep 17 00:00:00 2001 From: ChengQiu Date: Mon, 25 Apr 2016 15:59:06 +0800 Subject: [PATCH 1/3] add observer to editable property so that column will get templatized whenever it is changed to true --- paper-datatable-column.html | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/paper-datatable-column.html b/paper-datatable-column.html index 656c694..11e7a12 100644 --- a/paper-datatable-column.html +++ b/paper-datatable-column.html @@ -117,7 +117,10 @@ * @type Boolean * @default false */ - editable: Boolean, + editable: { + type: Boolean, + observer: '_initTemplate' + } /** * If `type` is an `Array` and the array consists of `Object`s it's a common need * to display a single property of every object (in non-editable mode). @@ -285,6 +288,10 @@ }, + _initTemplate: function(){ + this.ready(); + }, + _createCellInstance: function(model, notificationKey){ if(typeof model[this.property] == 'undefined' && typeof this.default !== 'undefined'){ var instance = this.stamp({item: model, column:this, value: this.default, _dataKey: notificationKey}); From e5ab4fdff77106423250ae8d3c418f289ae72069 Mon Sep 17 00:00:00 2001 From: ChengQiu Date: Mon, 25 Apr 2016 16:06:49 +0800 Subject: [PATCH 2/3] miss a comma --- paper-datatable-column.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/paper-datatable-column.html b/paper-datatable-column.html index 11e7a12..258f961 100644 --- a/paper-datatable-column.html +++ b/paper-datatable-column.html @@ -120,7 +120,7 @@ editable: { type: Boolean, observer: '_initTemplate' - } + }, /** * If `type` is an `Array` and the array consists of `Object`s it's a common need * to display a single property of every object (in non-editable mode). From bd5f22b3cc6f885badf4407d172a0ae95da1f5e5 Mon Sep 17 00:00:00 2001 From: ChengQiu Date: Mon, 25 Apr 2016 16:32:49 +0800 Subject: [PATCH 3/3] remove template if editable change to false --- paper-datatable-column.html | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/paper-datatable-column.html b/paper-datatable-column.html index 258f961..3e9ab41 100644 --- a/paper-datatable-column.html +++ b/paper-datatable-column.html @@ -289,7 +289,11 @@ }, _initTemplate: function(){ - this.ready(); + if( this.editable ){ + this.ready(); + } else { + this.template = false; + } }, _createCellInstance: function(model, notificationKey){