disable export button if gridbox data have been changed
[xtuple] / lib / enyo-x / source / views / grid_box.js
index 7f264d7..7383e29 100644 (file)
@@ -372,6 +372,10 @@ trailing:true, white:true, strict: false*/
       this.inherited(arguments);
       this.createComponents(this.buildComponents());
     },
+    allRowsSaved: function () {
+      return _.every(this.getValue().models,
+                     function (e) { return e.isReadyClean(); });
+    },
     buttonTapped: function (inSender, inEvent) {
       var editor = this.$.editableGridRow,
         model,
@@ -537,6 +541,7 @@ trailing:true, white:true, strict: false*/
     refreshLists: function () {
       this.$.aboveGridList.refresh();
       this.$.belowGridList.refresh();
+      this.$.exportButton.setDisabled(! this.allRowsSaved());
     },
     reset: function () {
       this.setEditableIndex(null);
@@ -624,6 +629,8 @@ trailing:true, white:true, strict: false*/
       if (this.$.summaryPanel) {
         this.$.summaryPanel.setValue(model);
       }
+
+      this.$.exportButton.setDisabled(! this.allRowsSaved());
     }
   });
 }());