Domanda

i have this as my dgrid constructor ,

var MyQuickGrid = declare([onDemandGrid,Keyboard,Selection,ColumnHider,ColumnResizer,ColumnReorder]);

and the partial config_opts are

var config_opts = {
         loadingMessage: "   Loading data...",
     noDataMessage: "No results found."
        }

. . .

 lang.mixin(grid_opts,config_opts);
 window.grid = new MyQuickGrid(grid_opts,'node_of_intrest');

however when i request data from the server using a JsonRESTStore, and the returned json data is empty i.e "[]" the grid does not display the "noDataMessage", i initially thought this was because of the headers i was returning, since i was returning 200 OK even for empty results set, i changed this to 204 No Content but still nothing seems to be working. I would appreciate a work around, or even a way to know if the grid failed to get results cuz this native feature for some reasons seem to be too smart for me for now.

È stato utile?

Soluzione

Mentioned by nbjoerg on IRC

make sure your JsonRest server is setting the proper Content-Range headers in its query responses (e.g. in this case it should be "items 0-0/0").

For more info on how Dojo expects JsonRest endpoints to behave, see http://dojotoolkit.org/reference-guide/1.9/quickstart/rest.html

Here's an example of the headers returned by a JsonRest service for which noDataMessage displays fine:

Connection:Keep-Alive
Content-Length:2
Content-Range:items 0-0/0
Content-Type:application/json
Date:Thu, 19 Sep 2013 12:56:19 GMT
Keep-Alive:timeout=5, max=92
Server:Apache/2.2.12 (Win32) DAV/2 mod_ssl/2.2.12 OpenSSL/0.9.8k mod_autoindex_color PHP/5.3.0
X-Powered-By:PHP/5.3.0

And a screenshot, for good measure:

enter image description here

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top