Opened 10 years ago

Closed 7 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: dirkvanderwalt@…
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)

movies.csv (317 bytes) - added by dvdwalt 10 years ago.
Sample movie data (CSV)
grid.html (2.7 KB) - added by dvdwalt 10 years ago.
Demo showing the UpdateRowCount event not displaying correct rowCount

Download all attachments as: .zip

Change History (12)

Changed 10 years ago by dvdwalt

Attachment: movies.csv added

Sample movie data (CSV)

Changed 10 years ago by dvdwalt

Attachment: grid.html added

Demo showing the UpdateRowCount event not displaying correct rowCount

comment:1 Changed 10 years ago by Nathan Toone

Milestone: tbd1.5
Summary: dojox.grid.DataGrid updateRowCount reports the wrong number of rowsdojox.grid.DataGrid needs attach points for rowCountChanged
Type: defectenhancement

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 10 years ago by Nathan Toone

severity: majornormal

comment:3 Changed 10 years ago by dvdwalt

'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 10 years ago by Nathan Toone

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 10 years ago by dvdwalt

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 10 years ago by Nathan Toone

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 10 years ago by bill

Milestone: 1.5future

comment:8 Changed 9 years ago by Nathan Toone

Owner: Nathan Toone deleted

Unassigning my tickets.

comment:9 Changed 7 years ago by bill

DojoX Grid and EnhancedGrid are deprecated in favor of dgrid and gridx.

You should upgrade your code to use one of those two grids.

We will consider patches to the old DojoX Grid code though.

comment:10 Changed 7 years ago by bill

Resolution: patchwelcome
Status: newclosed
Note: See TracTickets for help on using tickets.