Opened 15 years ago
Closed 14 years ago
#5032 closed defect (wontfix)
Cannot change dojox.grid.data.Objects objects on the fly
Reported by: | Bryan Forbes | Owned by: | Bryan Forbes |
---|---|---|---|
Priority: | high | Milestone: | 1.1 |
Component: | DojoX Grid | Version: | 1.0 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
After a dojox.grid.data.Objects has been instantiated and used by a grid, you can no longer change the underlying objects to add more properties. I'm attaching a test case which contains two grids that change the underlying objects in the model, one by using model.setData() and one by instantiating a whole new model and using grid.setModel(). Both fail.
Attachments (3)
Change History (11)
Changed 15 years ago by
Attachment: | test_grid_object_model_change.html added |
---|
Changed 15 years ago by
Attachment: | test_data_objects.js added |
---|
comment:1 Changed 15 years ago by
Milestone: | 1.0.1 → 1.0.2 |
---|
comment:2 Changed 15 years ago by
Milestone: | 1.0.2 → 1.0.3 |
---|
comment:3 Changed 14 years ago by
Milestone: | 1.0.3 → 1.1 |
---|
comment:4 Changed 14 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
(In [12830]) !strict fixes #5032 To correct this problem, support was added to dojox.grid.data.Objects to allow for data structure changes. The issue here was specifically with automatic assignment of model fields. Fields are now auto-assigned when data is set and grid is notified that fields may have changed.
comment:5 Changed 14 years ago by
Resolution: | fixed |
---|---|
Status: | closed → reopened |
The solution implemented in changeset 12830 actually breaks certain scenarios that were working beforehand, and does not fix all other scenarios.
i) If the call to setModel or setData changes to a dataset with fewer rows than the existing dataset, the call throws an error "'this.data[...]' is null or not an object". (This was working in Dojo 1.0.2, in some circumstances). This is occurring because the call to this.notify("FieldsChange")
added in the allChange()
method of dojox.grid.data.Objects
(line 262 in model.js) forces a re-rendering of the grid after the data has been reset, but before the rowcount has been reset on the grid or scroller, and so an attempt is made to access non-existent rows.
This can be fixed by moving the call to this.notify("FieldsChange")
to after the call to the parent method. The call is needed, otherwise data can appear in the wrong columns in some circumstances.
ii) If the new dataset contains different or additional fields, and is applied using setData()
the new columns may not be displayed, even if present in the structure. This appears to be due to the autoAssignFields()
method not clearing existing fields before processing the new ones.
This can be fixed by adding a call to this.fields.clear()
before the for loop in autoAssignFields()
(line 267 in model.js).
I will attach a test page which can be used to demonstrate these problems. I am not certain if either of my fixes breaks anything else, but I have not experienced any problems in my pages.
Changed 14 years ago by
Attachment: | test_grid_object_model.html added |
---|
File to illustrate remaining problems
comment:6 Changed 14 years ago by
BTW, my environment is Dojo 1.1.1 in IE6.
Steps to reproduce the above problems with the attached file (after changing paths appropriately):
To get the error, leave the "Change no of data rows" checkbox checked, select "Use setModel" or "Use setData", click on "Change grid" button - 2 additional rows will be displayed. Click on the "Change grid" button again - display reduces to 2 rows, but the error is thrown (and the page will not function properly without a refresh).
To see the problem with data in an added column not being displayed, on a newly re-loaded page de-select the "Change no of data rows" checkbox, leaving the "Change no of data cols" checkbox checked. Select the "Use setData" radio button, and click on the "Change grid" button again - the grid will be re-displayed with an additional column "Supplier", empty of data. However, if you use "Use setModel", the additional data is displayed.
comment:7 Changed 14 years ago by
Owner: | changed from sorvell to Bryan Forbes |
---|---|
Status: | reopened → new |
Bryan, can you re-assess and set the milestone appropriately? Thanks
comment:8 Changed 14 years ago by
Resolution: | → wontfix |
---|---|
Status: | new → closed |
Closing because dojox.grid.data.Object doesn't exist anymore and we're not doing a 1.1.2 release.
Place this in grid/tests/support