#3153 closed defect (fixed)
handle null situation in JsonItemStore
Reported by: | guest | Owned by: | Jared Jurkiewicz |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | Data | Version: | 0.9 |
Keywords: | null jsonitemstore | Cc: | |
Blocked By: | Blocking: |
Description
this is the test data used by the jsonItemStore:
{ identifier: 'abbr', items: [ { abbr:'ec', name:'Ecuador', capital:'Quito' }, { abbr:'eg', name:'Egypt', capital:'Cairo' }, ]}
it works well like this. but after I replace a value into null,for example:
{ identifier: 'abbr', items: [ { abbr:'ec', name:null, capital:'Quito' }, { abbr:'eg', name:'Egypt', capital:'Cairo' }, ]}
then it fails. I found the problem in dojo/data/JsonItemStore.js line281:
for(i = 0; i < arrayOfItems.length; ++i){ item = arrayOfItems[i]; for(var key in item){ var value = item[key]; if(!dojo.isArray(value)){ item[key] = [value]; } attrNames[key]=key; } }
then I fixed it like this:
for(i = 0; i < arrayOfItems.length; ++i){ item = arrayOfItems[i]; for(var key in item){ var value = item[key]; if(value===null){ item[key]=[]; }else if(!dojo.isArray(value)){ item[key] = [value]; } attrNames[key]=key; } }
now it can handle null situation
Attachments (1)
Change History (8)
comment:1 Changed 14 years ago by
comment:2 Changed 14 years ago by
Component: | General → Data |
---|---|
Owner: | changed from anonymous to skinner |
comment:3 Changed 14 years ago by
Owner: | changed from skinner to Jared Jurkiewicz |
---|
comment:4 Changed 14 years ago by
Status: | new → assigned |
---|
Working on a solution. Cannot use provided solution as submitter is unknown and CLA signature is also unknown. Plus, the solution isn't quite correct anyway.
Changed 14 years ago by
Attachment: | dojo.data_JsonItemStore_20070601.patch added |
---|
Minor patch to fix null attribute case.
comment:5 Changed 14 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:6 Changed 14 years ago by
Tested and verified on:
Windows:
IE 6.0 IE 7.0 Firefox 2.0.0.4 Firefox 1.5.0.11 Opera 9.2
OS-X:
Note: See
TracTickets for help on using
tickets.
Who opened this ticket? Have they signed a CLA? The noted code can't be used without a CLA in place.