Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.

RowExpanded property works on visible rows only

This is probably expected behaviour but it confused me so I'll share it in case it prevents anyone else from the same confusion down the track.

To expand or collapse a row, it must be visible to the user or the property doesn't do anything. This is fine if your are setting it to false in order to collapse it because that suggests it's already expanded which generally would mean it's also visible.

The help documentation doesn't explicitly specify this and hence my confusion. Primarily surrounding this point from the help
Second, you can pass the index of a data row. In this case, the RowExpanded property will find the first group row preceding the data row and set its expanded state.

That's exactly what I wanted to do. I had a collapsed group that I wanted to expand. I didn't know the row numbers of the group row I needed but I did know the record numbers of the data records in that group. Based on this property I thought I could convert the record number to a data row number and then set the RowExpanded property of one of those rows and the preceding group row would expand.

After debugging, it made more sense because "rows" represent what the user sees and if the "record" is collapsed and therefore not visible, it doesn't have a corresponding "row" so the property is ineffective. I had mistakenly thought each record would still correspond to a row, visible or not.


  • I will admit that I dropped the ball in effectively communicating the difference between Record and Row. I should add a page to the Wiki just on this topic. Hopefully, this thread will be useful to others to understand the difference.

    Anything that uses the term Row, be it a property with Row in it or a method with Row as a parameter, refers to a row the user can see or scroll to. Thus, RowExpanded doesn't work when a row is invisible because the row does not actually exist at all in memory. Whenever you make changes to the table, such as sorting and grouping, the Report Table reallocates a new set of rows. Thus, a hidden row isn't virtualized or set to a height of 0; it just doesn't exist.

    Sorry you had to learn this the hard way.
  • All good Kev. The penny dropped once I saw recordToRow returned zero. I really think it was just that one line I quoted that sent me down the garden path. It implies, at least to me, that you can set the property/state of any data row which when you understand what a row is, is technically true but in practice you can only set it to false. You can never set a data row to true.

    .... well I guess you could but only if it already was.

    and fwiw, learning the hard way improved my understanding of the control overall.
Sign In or Register to comment.