Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Posting back UpdatePanel loses node selected (Read 4220 times)
jcollins@scires
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 53
Joined: Feb 17th, 2009
Posting back UpdatePanel loses node selected
Apr 3rd, 2009 at 1:14pm
Print Post  
Hello, I am using a diagram in javapplet mode. Below is my code:
aspx:
<body>
    <script type="text/javascript">
       function onObjectSelected(sender, args) {
           var node = args.getNode();

           if (sender.getSelection().size == 1) {
               document.getElementById('hdObjectSelectedTag').value = String(node.getTag());
              
               //tried both of the below to postback the updatepanel
               __doPostBack('UpdatePanelMain', '');
               //document.getElementById("<%= btnDummyObjectClicked.ClientID %>").click();
           }
       }
    </script>
    <form id="form1" runat="server">
    <asp:ScriptManager runat="server" ID="scriptmanager"></asp:ScriptManager>
    <div>
       <asp:UpdatePanel ID="UpdatePanelMain" runat="server" UpdateMode="Conditional">
           <Triggers>
               <asp:AsyncPostBackTrigger ControlID="btnDummyObjectClicked" />
           </Triggers>
           <ContentTemplate>
               <div>
                   <ndiag:DiagramView runat="server" ID="diagView" AutoScroll="true" Height="500px" Width="500px"  ClientSideMode="JavaApplet"
                     NodeSelectedScript="onObjectSelected">
                       <Diagram AllowSelfLoops="false" AutoResize="RightAndDown"
                       RouteLinks="true"  />
                   </ndiag:DiagramView>
                   <input type="button" id="btnDummyObjectClicked" runat="server" value="test"/>
                   <asp:HiddenField ID="hdObjectSelectedTag" runat="server" />
              </div>
           </ContentTemplate>
       </asp:UpdatePanel>
    </div>
    </form>
</body>

aspx.vb:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
       If Not IsPostBack Then
           diagView.Diagram.Factory.CreateShapeNode(10, 10, 25, 25)
       End If
    End Sub

    Private Sub btnDummyObjectClicked_ServerClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnDummyObjectClicked.ServerClick
       'this gets called, yet the selected object loses its selection..also seems the entire page is posting back
       'rather than the updatepanel
    End Sub



I tried posting back the updatepanel 2 different ways, one way with forcing a button click and the other just explicitly calling dopostback on the updatepanel. Both ways seem to lose the selected object as well as postback the entire page rather than the updatepanel. I need to be able to postback the update panel and keep the node selected. Any help would be greatly appreciated.
Thanks,
jay
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Posting back UpdatePanel loses node selected
Reply #1 - Apr 6th, 2009 at 3:36pm
Print Post  
Hi,

Replace this line:

__doPostBack('UpdatePanelMain', '');

with:

setTimeout("__doPostBack('UpdatePanelMain', '')", 20);

and it should work. Seems the problem happened because ActiveItem is set after this event is raised. When posting back with only one selected item, the Selection object is not saved in the postback field but only the ActiveItem. Alternatively, you could try setting the ActiveItem in this event handler before posting back, and it might work without using a timer.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
jcollins@scires
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 53
Joined: Feb 17th, 2009
Re: Posting back UpdatePanel loses node selected
Reply #2 - Apr 15th, 2009 at 9:21pm
Print Post  
That seemed to work for IE. But when I tested in Firefox, there is no postback at all regardless if i wrap it with a setTimeout. Any ideas how to handle this action in firefox? Thanks.
jay
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Posting back UpdatePanel loses node selected
Reply #3 - Apr 20th, 2009 at 11:15am
Print Post  
What happens if you change this line:
if (sender.getSelection().size == 1)
to:
if (sender.getSelection().size() == 1)
?
  
Back to top
 
IP Logged
 
jcollins@scires
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 53
Joined: Feb 17th, 2009
Re: Posting back UpdatePanel loses node selected
Reply #4 - Apr 20th, 2009 at 4:05pm
Print Post  
Making that change does work. In fact, after installing Java 6 Update 13, you will get a script error unless that change is made. Regarding Java 6 Update 13, after installing this I have noticed that when first loading the diagram there is extra shading showing up that should not be there. Only when you mouse over the shading does it then disappear. Do you happen to know what this about? Thanks
jay
  
Back to top
 
IP Logged
 
jcollins@scires
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 53
Joined: Feb 17th, 2009
Re: Posting back UpdatePanel loses node selected
Reply #5 - Apr 28th, 2009 at 7:48pm
Print Post  
Is there anything new with the shading issue? Can you confirm that this is happening with Java 6 Update 13? The diagram does not render correctly when loaded and when you mouse over the nodes/links most of the erroneous shading disappears. I know I have read elsewhere in this forum that when the Java people come out with a new release you guys have to update your software due to their changes. Is this the case with Update 13 as well?
Thanks,
jay
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Posting back UpdatePanel loses node selected
Reply #6 - Apr 29th, 2009 at 9:17am
Print Post  
I could not reproduce this. Does it happen with any browser? Could you email us a test page with your initialization settings and a saved diagram XML file that shows the problem?

Thanks,
Stoyan
  
Back to top
 
IP Logged
 
jcollins@scires
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 53
Joined: Feb 17th, 2009
Re: Posting back UpdatePanel loses node selected
Reply #7 - Apr 29th, 2009 at 3:00pm
Print Post  
I just tested your online demo and it is happening there as well. That definitely makes me think there is something wrong on my end. At one point I had a version of J2SE installed as well as Java 6 Update 13 installed at the same time. Maybe this messed something up? I tried uninstalling the J2SE version yet it was still happening. I emailed you the files anyways. It was happening in most browsers. Thanks,
jay
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Posting back UpdatePanel loses node selected
Reply #8 - Apr 29th, 2009 at 3:27pm
Print Post  
I still couldn't see any shading Undecided Could you email me a screenshot? Could you also try updating your video drivers - we had a case where this helped to a customer who got some black areas across the drawing canvas.
  
Back to top
 
IP Logged
 
jcollins@scires
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 53
Joined: Feb 17th, 2009
Re: Posting back UpdatePanel loses node selected
Reply #9 - Apr 29th, 2009 at 4:16pm
Print Post  
Hey Stoyan, After some trial and error, I finally figured it out. It was on my end. It had to do with the installation of Java 6 update 13. There is a setting in the Java Control Panel/Advanced tab/Java Plug-in, called "enable the next-generation Java Plug-in(requires browser restart". For some reason, it is checked after installation. From what I read, it seems that you need a 64bit operating system. I am not sure why it defaulted to checked since my OS is 32 bit. But unchecking that setting corrected everything. Thanks and I hope this helps out other users who may run into the same problem as I.
jay
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint