Get CollapsingRecordNode height inside GoPalette

I’ve currently got a CollapsingRecordNode inside a GoPalette, and I want to dynamically resize the GoPalette depending on the height of the CollapsingRecordNode.



However when I collapse the CollapsingRecordNode, the height property remains the same. Is there any way to access the collapsed height of the node?



Thanks in advance.

The height should be changing… it does if I use the Demo1 properties window. (note the properties window in the sample doesn’t update by itself, you have to select the node a second time to get it to refresh)

Hi Jake,



Yes you’re right, I’ve found that the height of the CollapsingRecordNode changes…but how can I grow/shrink the GoPalette each time the CollapsingRecordNode is collapsed/expanded, without doing a full postback (I have NoPost=“true” on the GoPalette).



Thanks again.

Changes in GoView or GoPalette size in GoWeb requires the change be made in javascript on the client side. (see Dynamic Resizing of Webforms)

But... for the script to realize that the CollapsingRecordNode is expanded or collapsed would require some sort of a hint generated on the server side and sent to the client. Have you done any work with GoViewDataRenderer?

Yes, we have worked with GoViewDataRenderer before…but doesn’t that apply only to a GoView?



Is there a way to apply that or something similar to a GoPalette?

GoPalette inherits from GoView.

Actually I would send the size (i.e. Width and Height) of the GoView to the client each time, and JavaScript on the client can set the Width and Height of the corresponding element correspondingly.
Don't call the goSize function that is in GoWeb.js, because that will result in another round trip (but not a postback). You would only call goSize (or any of the other functions that we provide in GoWeb.js) when the client wants to request some changes on the server.

Thanks Walter,
At the moment inside my GoPalette I have the CollapsingRecordNode class containing the CollapsingRecordNodeItemList class (as per Demo1). In the Collapse() method of the CollapsingRecordNodeItemList class I was attempting to resize the Document object (in bold) which I assumed was the GoPalette?:
Public Overridable Sub Collapse() Implements IGoCollapsible.Collapse
Try
If Not Me.IsExpanded Then Return
Dim hdr As GoObject = Me.Header
For Each obj As GoObject In Me
If Not obj Is hdr Then 'continue
Dim list As CollapsingRecordNodeItemList = Nothing
If TypeOf obj Is CollapsingRecordNodeItemList Then list = CType(obj, CollapsingRecordNodeItemList)
If Not list Is Nothing Then
list.WasExpanded = list.IsExpanded
list.Collapse()
End If
obj.Visible = False
obj.Printable = False
End If
Next
myIsExpanded = False
Changed(ChangedIsExpanded, 0, True, NullRect, 0, False, NullRect)
LayoutChildren(Nothing)
Me.Document.Size = New System.Drawing.SizeF(Me.Document.Size.Width, Me.Parent.Height)
Catch ex As Exception
Throw New Exception(mcstrMOD & “.Collapse()”, ex)
End Try

End Sub

If the client re-renders the whole page (or an update panel) this does work, however it looks ugly as there is a significant flicker.
It would be great if this could be all handled by the client (javascript).
I've tried to use GoViewDataRenderer and override HandleClientRequest, but can only get the dimensions before the GoPalette renders (which is before the CollapsingRecordNode has executed the collapse method).
Can I assume here that I'm heading in the wrong direction? If so, how can I do what you've suggested and send the relevant info to the client and resize the appropriate element?

A better way to set the size of the Document is to do

Me.Document.Bounds = Me.Document.ComputeBounds()

that will compute the size of the document that encloses the GoObjects within it.

Thanks Jake,



Although this still requires a postback to work…



Ultimately we’d like the GoPalette to resize so that its height is the same height as the CollapsingRecordNode within it, remembering this is the only item within this GoPalette.



The reason we are trying to do this is because we have the GoPalette within a fixed size

that allows overflow (overflow-y:scroll) giving us a vertical scrollbar when the GoPalette outgrows the
. HOWEVER, when the CollapsingRecordNode reduces to a size that is visibly smaller than the
, the scrollbar remains suggesting that the GoPalette is not shrinking to match the height of the CollapsingRecordNode.



We have managed to resize the GoPalette in the Collapse method of the CollapsingRecordNodeItemList class (code above), which after a postback gives us the result that we want. Unfortunately this is a very ugly way of achieving our goal.



What we’d like to do is resize the GoPalette in JavaScript and thus removing the requirement for a postback (I assume this is what Walter was eluding to when he said another round trip?).



Thanks again…





The scrollbar stays because the document will only grow, not shrink… unless you set the Bounds like I showed in my previous post.

[QUOTE=Jake]The scrollbar stays because the document will only grow, not shrink… unless you set the Bounds like I showed in my previous post. [/quote]I apologise if I’m wrong, but it appears as though you haven’t even been reading Dave’s posts - disappointing…

If there is a way to make this work I'd be very keen to see the solution as well. I have clients who often get frustrated using the scroll margin and the idea of a scrolling DIV surrounding the palette could be a great alternative.
Hopefully Walter can extend on his post.

I’m working on some sample code for Dave…