Opened 14 years ago

Closed 14 years ago

#6017 closed defect (fixed)

Grid + DojoData model causes unnecessary call to fetch

Reported by: guest Owned by: benschell
Priority: high Milestone: 1.1
Component: DojoX Grid Version: 1.0
Keywords: Cc:
Blocked By: Blocking:


Firefox Windows Vista

Calling DojoData.refresh() results in two calls to the implementation.

Attachments (1)

6017.patch (1.1 KB) - added by benschell 14 years ago.

Download all attachments as: .zip

Change History (5)

comment:1 Changed 14 years ago by benschell

Owner: changed from sorvell to benschell

Worked with reporter on this, grabbing to work on.

comment:2 Changed 14 years ago by dylan

Milestone: 1.1

comment:3 Changed 14 years ago by benschell

Status: newassigned

The original intention of the clearData function introduced on the DojoData? model in #5555 / [12040] was to clear the data displayed in the Grid without doing any re-query-ing to the data store. If the user wished to have the data store re-queried, a 'refresh' function was provided in the same patch to provide this functionality.

However, the count variable on the data store was not reset. Therefore, despite the data array being cleared, the Grid, when notified that the data had been changed (due to an AllChange? notification during setData), believed that there was still data present and would then re-query the data store. Therefore, two bugs arose: if calling clearData, the store would be re-queried AND using model.refresh() would result in two queries to the data store, one due to the clearData/setData (same bug, really).

The fix is to simply reset the count of items when clearing the data array.

The patch includes two fixes. The first is a change to the existing test page (test_dojo_data_edit.html). The bug can be demonstrated by clicking the 'Clear Data (Model)' button, which calls clearData on the model. The expected behavior is that the model's data is cleared *without* a re-query, however the store is re-queried and the Grid refreshes with the data. The second is the fix to the bug, which results in the same test producing a cleared Grid (with no data displayed).

Changed 14 years ago by benschell

Attachment: 6017.patch added

comment:4 Changed 14 years ago by Douglas Hays

Resolution: fixed
Status: assignedclosed

(In [12850]) Fixes #6017 !strict. Proxy commit for benschell. Added count=0 to clearData to avoid requery of

Note: See TracTickets for help on using tickets.