Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#4963 closed defect (fixed)

Grid tests - multiple references to same objects

Reported by: guest Owned by: sorvell
Priority: lowest Milestone:
Component: DojoX Grid Version: 0.9
Keywords: Cc:
Blocked By: Blocking:


Several grid tests generate test data in a for loop.

data = [...array...]
for (var i=0; i<10; i++)
   data = data.concat(data);

The result is that the object references in the array actually point to the same data - for example, clicking the checkboxes into grid/tests/test_edit.html cause several other checkboxes in other rows below to be checked too.

This is a very small issue but may be confusing to people.

Suggested fix: Add the following line after data definition to make all rows refer to distinct objects:

data = dojo.fromJson(dojo.toJson(data))

Change History (2)

comment:1 Changed 14 years ago by sjmiles

Resolution: fixed
Status: newclosed

(In [11303]) Some style tweaks (class names should be capitalized). Change sample data generation, fixes #4963.

comment:2 Changed 14 years ago by sjmiles

Oops. Yes, data ended up being a set of references to only seven distinct data arrays. This was fine, unless editing is involved.

The Json trick is clever, but instead, I tried to make it more obvious by appending array copies up to a defined number of rows.

Note: See TracTickets for help on using tickets.