Javascript after goReload

I've got the NoPost="true". I need to know in the javascript when a subgroup or one of its sub items are selected. I was able to use the label on the items and just encode something to say whether its in the group or not (the label text is accessible from javascript). When I try to do this for the GoSubGraph, however, the text disappears and the value doesn't seem to be available on the client either. If I overrode the GoViewDataRenderer.LabeledNodeSingleClick and GoVeiwDataRenderer.NoClick, I can pickup on when items get selected but I need to know how to determine if the group is selected via client side text property or anything that works. I tried overriding the PrimaryView_ObjectGotSelection and I can determine it on the server side but I don't know how to pass the info back to the javascript on the client side because this callback seems to get called from a change in the img.src property rather than some sort of postback. Any thoughts on where I could go with this? Perhaps there is something more I can do with GoViewDataRenderer to apply a tag to all the elements or something. Any thoughts? Thanks. Jayme

I don’t understand if you want to handle everything on the client or on the server.
If you want to handle it on the client, rather than defining any more methods on the server, I would do as you last suggest, namely add information to be sent to the client.
The easiest way to do that is to override JGoObject.GetPartInfo and make sure you added the extra property-values you need, for both your items and your subgroups. Then your JavaScript code can look at the information (presumably the value of goInfo) to decide if it’s a subgraph or an item or whatever.
There are a bunch of examples in the sample web applications, and in the documentation.

If you want to handle it on the server, you can either do a postback through the normal ASP.NET mechanism, or you can call the JavaScript function goPost. The latter does either a post (actually a GET) to the GoWebImage, or a postback of the whole Page, depending on the value of img.goNoPost.
If you do not want to do an ASP.NET postback but you need to have your web application run some code on the server, and you need to pass some data along, send the data as string arguments in the call to goPost. Override GoView.RaisePostBackEvents to parse the argument string to look for your request. If you find it, do what you want to do, otherwise call the base method.
In 2.5, but I believe not in the current beta release, we have predefined a “request” query to make it easier to implement this server-side capability. You’ll be able to call the goRequest JavaScript function, which will call GoViewDataRenderer.HandleClientRequest on the server, passing it not only the post data string that you would get in the call to GoView.RaisePostBackEvents, but also a Hashtable holding the parsed parameter-value pairs from that string.
Example. On the client you could call the JavaScript expression:
goRequest(‘MyView’, ‘color=’ + colorname);
This would call your custom GoViewDataRenderer on the server:

public override void HandleClientRequest(String evtargs, Hashtable parameters) {<?:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

String color = (String)parameters["color"];

if (color != null) {

Color c = FromString(color);

SolidBrush b = new SolidBrush(c);

foreach (GoObject obj in this.View.Selection) {

GoShape shape = obj as GoShape;

if (shape != null) {

shape.Brush = b;

}

}

}

}

After all of the code runs on the server, it generates a new GoView image which it streams back to the client, so the user sees that the selected objects have a new color. And the client gets a refreshed set of data describing the visible parts of the diagram.

The GetPartInfo stuff is on the right track. That stuff only generates when a postback occurs so I have to post back repeatedly. If you come up with a way to do this without the full page postback, please let me know.
I’d like to do everything without postback’s. The only thing I can’t do is change my “palette” items in response to someone selecting the SubGraph or one of the contained objects.
I might be able to come up with solution using Atlas but that’s a pain.
Jayme

No, every time an image is reloaded and img.goNoPost is true, there’s a call to goReloadData, which will reload all the data generated by GoViewDataRenderer earlier on the server at the time the GoWebImage handler created and streamed the image.
If you move around a node in the web samples, you’ll note that the cursor and tooltip and other information get updated automatically with each new image. There are no postbacks, but the data is re-rendered and reloaded.
If you want to have another GoView be reloaded automatically after each time a view has handled its events, you can call the goAddUpdate JavaScript function. The first argument identifies the “main” view. The second argument identifies the view to be reloaded. This is the same mechanism GoOverview uses to automatically keep its image up-to-date as the Observed GoView is changed, and also to update the Observed GoView as the user clicks or drags in the GoOverview.
So I don’t think you need to do a postback to update your palette, based on clicking on a particular object in your main view. Your click handler can identify the kind of node the user clicked on, and if appropriate, can call goReload of the palette view. I don’t think you need to use the “goAddUpdate” function, but perhaps I misunderstand your requirements.
In any case, I don’t see why you should ever have to do a postback, unless you need to for some reason not involving GoDiagram.

It turns out, I had a different problem item on the page that made the mechanism stop working until the next postback. Its difficult to track this stuff because view source does not result in the current source so I didn’t know what was going on underneath. Thanks much for your help. This is an excellent product!