Why isn't the Expand event raised when I call the ExpandRow method

Posted by: j2associates on 8 September 2017, 1:10 pm EST

  • Posted 8 September 2017, 1:10 pm EST

    Hello,


    It appears that the Expand event is not raised when I use the ExpandRow method in code. Is this the case or am I missing something here? If it is not raised, why is it not raised? The logical place to put any customization code is in the Expand event so that you handle the user clicking the node. So if I don't want to do anything special programmatically except implement Expand All, Collapse All buttons on my main form, all I should have to do is loop through all of the rows in the sheet and call ExpandRow. It is counter intuitive that I should also have to manually call the Expand event.


    Obviously, for large customizations you may want to pull everything into a separate method and call the method from both places. But I shouldn't have to be forced to do this, especially for small changes.

  • Replied 8 September 2017, 1:10 pm EST

    j2 -

    According to this post the event will not fire when calling ExpandRow.  The ChildViewCreated event will fire, however.

    http://www.clubfarpoint.com/Forums/forums/thread/43567.aspx
  • Replied 8 September 2017, 1:10 pm EST

    Hello BobM,


    I saw that thread earlier. My question is why doesn't it fire? That is counter intuitive. It would seem logical that the ExpandRow method would fire the Expand event so you don't have to put code in 2 places or be forced to pull it out into a separate method for the same reason. By the way, the ChildViewCreated event is not fired that I can see. I put a break point on it and it never hit it either by clicking on the expand node or calling ExpandRow from a button click.

  • Replied 8 September 2017, 1:10 pm EST

    I used this code in the hierachyVB sample and the childviewcreated event is fired:

        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            FpSpread1.Sheets(0).ExpandRow(1, True)
        End Sub

    The difference is whether the sheet has already been expanded.
  • Replied 8 September 2017, 1:10 pm EST

    j2 -

    The ChildViewCreated event is firing for me in my test.  I agree that it would seem the Expand event should fire when calling the ExpandRow method so I can only assume that there must be a reason the developers didn't hook them up.
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels