Opened 11 years ago

Closed 11 years ago

Last modified 10 years ago

#8084 closed defect (fixed)

JsonRestStore Identity attribute not added when value is 0

Reported by: Phil Kaasa Owned by: Kris Zyp
Priority: high Milestone: 1.3
Component: DojoX Data Version: 1.2.1
Keywords: jsonreststore Cc: phil.kaasa@…
Blocked By: Blocking:

Description

Browser: Firefox 3.0.3 and IE 7.0 OS: Windows XP SP2

Summary: If the identity property of an object has 0 as its value, the JsonRestStore? (or something it inherits from) doesn't correctly add the id property when using the fetch() method. This makes it impossible to load that data in a DataGrid?.

I have a JsonRestStore? hooked up to a REST service that returns a JSON array of objects. The identity property of those objects is the "id" property.

For reference, this is sample data that my service might return (the data given will cause the behavior I am describing):

[{

"ani": 1993, "ccrId": 1809739408, "id": -2, "dnis": 930, "firstName": "Alex", "lastName": "Anderson"

}, {

"ani": 3140, "ccrId": 26349579, "id": -1, "dnis": 7799, "firstName": "Bob", "lastName": "Roberts"

}, {

"ani": 6671, "ccrId": 516548029, "id": 0, "dnis": 413, "firstName": "John", "lastName": "Anderson"

}, {

"ani": 7818, "ccrId": 880641847, "id": 1, "dnis": 8864, "firstName": "Jean", "lastName": "Adams"

}, {

"ani": 5959, "ccrId": 1935844040, "id": 2, "dnis": 5091, "firstName": "Alice", "lastName": "James"

}]

When I view the attached HTML, the attached output is shown on the console (first 5 lines using fetch(), last 2 lines using fetchItemByIdentity()).

As you can see, when I use fetch(), the id property is not added to the object when id=0; whereas when I use fetchItemByIdentity(), the id property is added when id=0.

This is causing an "Identity attribute not found" exception when I try to load data like this into a DataGrid?. Because of the exception, the grid is stuck loading. I do not receive that exception, and the grid loads correctly if the data doesn't include any objects where id=0.

Attachments (3)

test.html (1.2 KB) - added by Phil Kaasa 11 years ago.
Test Javascript.
data.json (674 bytes) - added by Phil Kaasa 11 years ago.
Test Data
test.output (187 bytes) - added by Phil Kaasa 11 years ago.
Test Output

Download all attachments as: .zip

Change History (7)

Changed 11 years ago by Phil Kaasa

Attachment: test.html added

Test Javascript.

Changed 11 years ago by Phil Kaasa

Attachment: data.json added

Test Data

Changed 11 years ago by Phil Kaasa

Attachment: test.output added

Test Output

comment:1 Changed 11 years ago by Jared Jurkiewicz

Owner: changed from Jared Jurkiewicz to kriszyp

comment:2 Changed 11 years ago by Jared Jurkiewicz

Owner: changed from kriszyp to Kris Zyp

comment:3 Changed 11 years ago by Kris Zyp

Resolution: fixed
Status: newclosed

(In [16368]) Fixes #8084, handles the id property even when it is 0.

comment:4 Changed 10 years ago by Adam Peller

Milestone: tbd1.3

batch move of tickets marked 'tbd' fixed in the 1.3 timeframe

Note: See TracTickets for help on using tickets.