respond to code review
[xtuple] / lib / enyo-x / source / views / grid_box.js
index 7383e29..17898fe 100644 (file)
@@ -374,7 +374,7 @@ trailing:true, white:true, strict: false*/
     },
     allRowsSaved: function () {
       return _.every(this.getValue().models,
-                     function (e) { return e.isReadyClean(); });
+                     function (model) { return model.isReadyClean(); });
     },
     buttonTapped: function (inSender, inEvent) {
       var editor = this.$.editableGridRow,
@@ -539,9 +539,11 @@ trailing:true, white:true, strict: false*/
       this.doExportAttr({ attr: gridbox.attr });
     },
     refreshLists: function () {
+      var collection = this.getValue();
       this.$.aboveGridList.refresh();
       this.$.belowGridList.refresh();
-      this.$.exportButton.setDisabled(! this.allRowsSaved());
+      this.$.exportButton.setDisabled(! this.allRowsSaved() ||
+                                      ! collection.length);
     },
     reset: function () {
       this.setEditableIndex(null);
@@ -630,7 +632,8 @@ trailing:true, white:true, strict: false*/
         this.$.summaryPanel.setValue(model);
       }
 
-      this.$.exportButton.setDisabled(! this.allRowsSaved());
+      this.$.exportButton.setDisabled(! this.allRowsSaved() ||
+                                      ! collection.length);
     }
   });
 }());