Opened 11 years ago
Closed 8 years ago
#10194 closed enhancement (patchwelcome)
dojox.grid.DataGrid needs attach points for rowCountChanged
Reported by: | dvdwalt | Owned by: | |
---|---|---|---|
Priority: | high | Milestone: | future |
Component: | DojoX Grid | Version: | 1.4.0b |
Keywords: | DojoX Grid updateRowCount | Cc: | [email protected]… |
Blocked By: | Blocking: |
Description
Hi,
My setup has the following:
Item | Detail |
Dojo | Version 1.3 and 1.4 (Broken) |
Dojo | Version 1.2 (Working) |
Browser | Firefox 3.0.6 |
OS | Ubuntu Hard Heron (8.04) |
Component | dojox.grid.DataGrid? |
Problem
- Using Dojo Version 1.2, I could connect to the UpdateRowCount event of dojox.grid.DataGrid and then when the event fires, I could get the row count of the grid by reading the rowCount propetry of the grid.
- Trying the same in version 1.3 and 1.4 of Dojo, this always returns 0 (Zero)
- I can get the correct row count from the grid when other events fire (EG when I click in the grid and set the query during the click event.
- I'm ataching a small demo file taken from dojoCampus sample.
- This is a much needed requirement since I display the row count as feedback to a user at the area above the grid, and would really like to update to the latest Dojo version
Attachments (2)
Change History (12)
Changed 11 years ago by
Attachment: | movies.csv added |
---|
Changed 11 years ago by
Demo showing the UpdateRowCount event not displaying correct rowCount
comment:1 Changed 11 years ago by
Milestone: | tbd → 1.5 |
---|---|
Summary: | dojox.grid.DataGrid updateRowCount reports the wrong number of rows → dojox.grid.DataGrid needs attach points for rowCountChanged |
Type: | defect → enhancement |
There are two issues here:
1 instead of accessing grid.rowCount directly, you need to access it by attr - ie grid.attr("rowCount"). 2 the grid doesn't always call updateRowCount when its row count changes. In the interest of performance, that call has been removed in some cases.
I'm changing this to an enhancement, and changing the summary, because we need to have some additional events to be able to attach to (I thought there was a bug already for it - but I couldn't find it).
comment:2 Changed 11 years ago by
severity: | major → normal |
---|
comment:3 Changed 11 years ago by
'2.)the grid doesn't always call updateRowCount when its row count changes'
- In the sample I posted the updateRowCount do trigger, so that's not a problem to me.
- The problem is the value of grid.attr("rowCount"); when it does trigger. Its always 0 (Zero)
- In version 1.2 the value of grid.attr("rowCount"); was correct when updateRowCount triggered.
comment:4 Changed 11 years ago by
In your example, your callback is called once - but should be called twice.
It should be called when we start the query - with a value of 0 - when we clear any existing data. It should be called a second time - with the number of rows from the store - when the fetch is completed.
So - you are only seeing the first one - and the value is *correctly* being returned as 0. (you aren't getting called the second time).
And yes - that function (updateRowCount), *was* called in 1.2 - but beginning with 1.3, we changed the way that updateRowCount was handled so that we didn't need to render the grid as often.
comment:5 Changed 11 years ago by
Thanks for the reply.
I've found a '_onFetchComplete' callback which triggers when it needs to, then I can read the row count and update the feedback.
This was the only stumbling block for me, so now I can upgrade my application. :)
Regards
comment:6 Changed 11 years ago by
I'm glad that's working for you, however, as a private function, it's not the "ideal" solution. It will work for 1.4 (and may work beyond that as well) - but there is no "contract" with private functions...they may or may not work in the future.
However, I'm hoping to have the "real" solution (the attach point for rowCountChanged) in by 1.5...so at the very worst, if it breaks (which I'm not forseeing - but may happen), you'll just need to change and attach to the correct function in the future.
Sorry for any confusion. Thanks for the enhancement report!
comment:7 Changed 11 years ago by
Milestone: | 1.5 → future |
---|
comment:9 Changed 8 years ago by
comment:10 Changed 8 years ago by
Resolution: | → patchwelcome |
---|---|
Status: | new → closed |
Sample movie data (CSV)