GoView ObjectDoubleClicked - odd behaviour

Hi

We are using GoDiagram Web 3.0.2. I’ve created a GoView object inside a web page which is dynamically populated with GoTextNodes and GoLabeledLinks.

Currently I’m handling the OnLinkCreated and OnObjectDoubleClicked events from the GoView.

They both fire ok, but there’s a strange behaviour after ObjectDoubleClicked is fired:

In the method-handling event in my page (the one that handles ObjectDoubleClicked), I can perform actions on the GoView (e.g. change the colour of the clicked node). This works ok.
However I also want to make changes to the rest of the page (e.g. make a panel visible, change some text). I have added the code which does this, and tracing it via Breakpoints in Visual Studio shows that the code executes and the values of the variables are changed correctly, but the problem is that when the postback finishes, the changes don’t show on the web page!

This code works when executed with a postback not associated with the OnDoubleClicked event, so it’s not my code.

It seems that anything that happens after this event that isn’t directly related to changing the GoView just doesn’t happen on the page, even if the code appears to run.
I don’t have this problem when handling OnLinkCreated. I haven’t tried any other GoView events.

Anybody seen this, or have any suggestions?

Thanks

Right. When you make the trip through the server with NoPost=true… the script running in GoWeb.js updates 2 things: the (GoView) image and the script that GoViewDataRenderer generates.



But… you can easily specify what JavaScript runs on the client for interesting events, like LabeledNodeDoubleClick.



Check the GoWebIntro document, the section on Customizing Client-side behavior.

Hi Jake

Thanks for your reply.

Ok so I read the intro document as suggested.

I decided I could use GoView.DataRenderer.LabeledNodeDoubleClick and define a Javascript function that would run when the user double clicks a node. That’s all fine.

What I need it to do now is do a ‘normal’ postback at this point so that my event fires and does the necessary alterations to the rest of the page. I can’t really do it clientside because it’s too complicated (I was simplifying when I said ‘altering text’) - i.e. initialising a user control and binding a complex FormView.

The problem is (and this may be because I know more or less nothing about Javascript) I don’t know I get the correct arguments to pass to __doPostBack() - do you know how I would do this? Or am I barking up the wrong tree?

Thanks
Andy

(P.S. Although it would solve it, I don’t want to set NoPost to false because the constant postbacks as users click around the diagram are unfriendly and distracting)

If you’re using ASP.NET AJAX, you can put your controls in an UpdatePanel and refresh it manually using JavaScript. I don’t recall off-hand how to do that, but I know it can be done.

As should be clear if you think about it a minute, the GoView should not be in an UpdatePanel, since UpdatePanels do partial postbacks.

Hi

Thanks for the suggestions. I eventually managed to get it to do what I wanted by doing the following:

    gvw_TreeView.DataRenderer.LabeledNodeDoubleClick = "__doPostBack('__Page', '@@@@Edit_' + goInfo.ID);";

protected void Page_Load(object sender, EventArgs e)
{

    if (this.IsPostBack)
    {
        string eventArg = Request["__EVENTARGUMENT"];
        if (eventArg != null)
        {
            int offset = eventArg.IndexOf("@@@@Edit"); //check it's an event raised by the javascript
            if (offset > -1)
            {
                string[] args = eventArg.Split(new string[] { "_" }, StringSplitOptions.None);
                gvw_TreeView = gvw_TreeView.FindSessionView();
                GoNode node = (GoNode) gvw_TreeView.Document.FindPart(int.Parse(args[1]));
                showEditForm(node);
            }
        }

    }
}

Andy