Opened 11 years ago

Closed 11 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)

dojox.grid._data.model_20080130.patch (2.7 KB) - added by Jared Jurkiewicz 11 years ago.
Fix for handling empty resultsets.

Download all attachments as: .zip

Change History (3)

Changed 11 years ago by Jared Jurkiewicz

Fix for handling empty resultsets.

comment:1 Changed 11 years ago by Jared Jurkiewicz

(In [12215]) Fix for handling empty resultsets. refs #5728 !strict

comment:2 Changed 11 years ago by Jared Jurkiewicz

Resolution: fixed
Status: newclosed

(In [12216]) Fix for handling empty resultsets. fixes #5728 !strict

Note: See TracTickets for help on using tickets.