Changeset 14197
- Timestamp:
- 06/27/08 15:04:35 (5 months ago)
- Location:
- dojox/trunk/grid
- Files:
-
- 4 added
- 7 modified
-
DataGrid.js (modified) (4 diffs)
-
nls (added)
-
nls/grid.js (added)
-
resources/Grid.css (modified) (1 diff)
-
resources/nihiloGrid.css (modified) (1 diff)
-
resources/soriaGrid.css (modified) (1 diff)
-
resources/tundraGrid.css (modified) (1 diff)
-
resources/_Grid.html (modified) (1 diff)
-
tests/test_grid_messages.html (added)
-
tests/test_grid_messages_autoheight.html (added)
-
_Grid.js (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
dojox/trunk/grid/DataGrid.js
r14196 r14197 21 21 rowCount: 0, 22 22 23 _isLoaded: false, 24 _isLoading: false, 25 23 26 postCreate: function(){ 24 27 this._pages = []; … … 129 132 } 130 133 } 134 if(!this._isLoaded){ 135 this._isLoading = false; 136 this._isLoaded = true; 137 if(!items || !items.length){ 138 this.showMessage(this.noDataMessage); 139 }else{ 140 this.showMessage(); 141 } 142 } 131 143 this._pending_requests[req.start] = false; 132 144 }, … … 134 146 _onFetchError: function(err, req){ 135 147 console.log(err); 148 if(!this._isLoaded){ 149 this._isLoading = false; 150 this._isLoaded = true; 151 this.showMessage(this.errorMessage); 152 } 136 153 this.onFetchError(err, req); 137 154 }, … … 143 160 var start = start || 0; 144 161 if(this.store && !this._pending_requests[start]){ 162 if(!this._isLoaded && !this._isLoading){ 163 this._isLoading = true; 164 this.showMessage(this.loadingMessage); 165 } 145 166 this._pending_requests[start] = true; 146 167 //console.log("fetch: ", start); -
dojox/trunk/grid/resources/Grid.css
r14040 r14197 27 27 .dojoxGrid-master-view { 28 28 position: relative; 29 } 30 31 /* master messages */ 32 33 .dojoxGrid-master-messages { 34 position: relative; 35 padding: 1em; 36 text-align: center; 37 background-color: white; 29 38 } 30 39 -
dojox/trunk/grid/resources/nihiloGrid.css
r14146 r14197 27 27 .nihilo .dojoxGrid-master-view { 28 28 position: relative; 29 } 30 31 /* master messages */ 32 33 .nihilo .dojoxGrid-master-messages { 34 position: relative; 35 padding: 1em; 36 text-align: center; 37 background-color: #fefefe; 29 38 } 30 39 -
dojox/trunk/grid/resources/soriaGrid.css
r14146 r14197 27 27 .soria .dojoxGrid-master-view { 28 28 position: relative; 29 } 30 31 /* master messages */ 32 33 .soria .dojoxGrid-master-messages { 34 position: relative; 35 padding: 1em; 36 text-align: center; 37 background-color: #fefefe; 29 38 } 30 39 -
dojox/trunk/grid/resources/tundraGrid.css
r14146 r14197 27 27 .tundra .dojoxGrid-master-view { 28 28 position: relative; 29 } 30 31 /* master messages */ 32 33 .tundra .dojoxGrid-master-messages { 34 position: relative; 35 padding: 1em; 36 text-align: center; 37 background-color: #fefefe; 38 } 39 40 .tundra .dojoxGridLoading, 41 .tundra .dojoxGridError { 42 background-position:left center; 43 background-repeat: no-repeat; 44 padding-left:25px; 45 } 46 47 .dijitRtl .tundra .dojoxGridLoading, 48 .dijitRtl .tundra .dojoxGridError, 49 .dijitRtl .tundra .dojoxGridNoData { 50 background-position:right; 51 padding-right:25px; 52 padding-left:0px; 53 } 54 55 .tundra .dojoxGridLoading { 56 background-image: url('../../../dijit/themes/tundra/images/loading.gif'); 57 } 58 59 .tundra .dojoxGridError { 60 background-image: url('../../../dijit/themes/tundra/images/warning.png'); 29 61 } 30 62 -
dojox/trunk/grid/resources/_Grid.html
r13793 r14197 2 2 <div class="dojoxGrid-master-header" dojoAttachPoint="viewsHeaderNode"></div> 3 3 <div class="dojoxGrid-master-view" dojoAttachPoint="viewsNode"></div> 4 <div class="dojoxGrid-master-messages" style="display: none;" dojoAttachPoint="messagesNode"></div> 4 5 <span dojoAttachPoint="lastFocusNode" tabindex="0"></span> 5 6 </div> -
dojox/trunk/grid/_Grid.js
r14195 r14197 15 15 16 16 dojo.require("dijit.Menu"); 17 18 dojo.requireLocalization("dijit", "loading"); 19 dojo.requireLocalization("dojox.grid", "grid"); 17 20 18 21 (function(){ … … 158 161 // Used to store the last two clicks, to ensure double-clicking occurs based on the intended row 159 162 _click: null, 163 164 // loadingMessage: String 165 // Message that shows while the grid is loading 166 loadingMessage: "<span class='dojoxGridLoading'>${loadingState}</span>", 167 168 // errorMessage: String 169 // Message that shows when the grid encounters an error loading 170 errorMessage: "<span class='dojoxGridError'>${errorState}</span>", 171 172 // noDataMessage: String 173 // Message that shows if the grid has no data 174 noDataMessage: "<span class='dojoxGridNoData'>${noData}</span>", 160 175 161 176 // private … … 184 199 this.connect(this, "onShow", "renderOnIdle"); 185 200 }, 201 202 postMixInProperties: function(){ 203 this.inherited(arguments); 204 var messages = dojo.mixin(dojo.i18n.getLocalization("dijit", "loading", this.lang), 205 dojo.i18n.getLocalization("dojox.grid", "grid", this.lang)); 206 this.loadingMessage = dojo.string.substitute(this.loadingMessage, messages); 207 this.errorMessage = dojo.string.substitute(this.errorMessage, messages); 208 this.noDataMessage = dojo.string.substitute(this.noDataMessage, messages); 209 }, 210 186 211 postCreate: function(){ 187 212 // replace stock styleChanged with one that triggers an update … … 421 446 return null; 422 447 }, 448 449 showMessage: function(message){ 450 if(message){ 451 this.messagesNode.innerHTML = message; 452 this.messagesNode.style.display = ""; 453 }else{ 454 this.messagesNode.innerHTML = ""; 455 this.messagesNode.style.display = "none"; 456 } 457 }, 423 458 424 459 _structureChanged: function() { … … 566 601 // views are position absolute, so they do not inflate the parent 567 602 if(this.autoHeight){ 568 this.viewsNode.style.height = this.views.measureContent() + 'px'; 603 var size = Math.max(this.views.measureContent(), dojo.marginBox(this.messagesNode).h) + 'px'; 604 this.viewsNode.style.height = size; 569 605 } 570 606 },