Opened 14 years ago
Closed 14 years ago
#5728 closed defect (fixed)
dojox.grid.data.DojoData does not properly handle empty resultsets.
Reported by: | Jared Jurkiewicz | Owned by: | sorvell |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | DojoX Grid | Version: | 1.0 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
dojox.grid.data.DojoData? does not properly handle empty result sets.
This problem was detected while examining a problem a user posted to the Dojo Interests mailing list. The gist of the problem is the Model will fault out if a query returns 0 results, because processRows always assumes *1* result:
See code:
processRows: function(items, request){
console.debug(arguments); if(!items){ return; } this._setupFields(items[0]);
Where _setupFields is:
_setupFields: function(dataItem){
abort if we already have setup fields if(this.fields._nameMaps){
return;
} set up field/index mappings var m = {}; console.debug("setting up fields", m); var fields = dojo.map(this.store.getAttributes(dataItem),
Calling getAttributes on an 'undefined' or anything not an item, will result in an error being thrown as per the dojo.data spec.
The fix for this should be:
processRows: function(items, request){
console.debug(arguments);
if(!items items.length == 0){ return; }
Attachments (1)
Change History (3)
Changed 14 years ago by
Attachment: | dojox.grid._data.model_20080130.patch added |
---|
comment:1 Changed 14 years ago by
comment:2 Changed 14 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
Fix for handling empty resultsets.