Webdialog stops working after action_calback
-
Script structure:
User clicks a button
This sets an selection observer and opens a webdialog1
Each time the user clicks another SU entity the content of the webdialog1 is updated
In webdialog1 are clcikable hyperlinks pointing to a javascript that executes an action callback towards the script again.In that action callback, at ruby side a value in another webdialog is updated.
This all goes well.But from then on (so when the hyperlink is clicked in webdialog1 and the value is updated in webdialog2) the content of webdialog1 does not change anymore when clicking another SU entity.
Somewhere along the line something falls apart. Any ideas?
If wanted i can post a movie of the action.Thx,
Pout -
Hard to tell without some code. You got a bare-bone case?
Sounds like you're missing the references somewhere...
-
here it goes (it's still a dev)
1.webdialog 1 opened with:
$xdinfowindowke=UI;;WebDialog.new("xDInfo", true,"xDInfo",290,300,0,0,true) fn= $html_folder+"/xD_infowindow.html" $xdinfowindowke.set_file fn $xdinfowindowke.set_size(290,300) $xdinfowindowke.show {}
2.populated from ruby with
//activated each time another SU entity is clicked command = "_sendinfo('#{$sendobjectid}','#{$sendlist}')" $xdinfowindowke.execute_script(command)
3.javascript in webdialog 1
function _sendinfo(theobjectid, theinfo){ //fill in the rows attr=theinfo.split("|||"); for (i=0;i<attr.length;i++){ splitted=attr[i].split("$$$") var oRow = oBody.insertRow(-1); //insert the first cell var oCell = oRow.insertCell(-1); oCell.className="attrnames"; oCell.innerHTML = splitted[0]+";"; //insert the second cell var oCell = oRow.insertCell(-1); oCell.className="attrnames"; //if it is the objectname, make clickable if (i==0){ oCell.innerHTML = "<a href='javascript:_show4Dobject("+theobjectid+")'>"+splitted[1]+"</a>"; } else { //if the string contains ^ it means it is a link. split up if(splitted[1].indexOf("^") != -1){ waw=splitted[1].split("^"); oCell.innerHTML='<a href="'+waw[1]+'" target=_blank">'+waw[0]+'</a>'; } else { oCell.innerHTML = splitted[1]; } } } //add the end attach a last row var oRow = oBody.insertRow(-1); var oCell = oRow.insertCell(-1); oCell.height="1px"; oCell.colSpan="2"; oCell.className="split"; }
- This makes some html links in webdialog1 with this code:
<a href='javascript:_show4Dobject([i]id[/i])'>"[i]name[/i]"</a>
handled by this code in webdialog1:
function _show4Dobject(objectid){ query = 'skp;_show4dobjects@'+objectid; window.location.href = query; }
- Now back in SU this is handled by:
$xdinfowindowke.add_action_callback("_show4dobjects") {|$xdinfowindowke,p| #check if the xdwindow is open--> [b]this is another window[/b] if $xdwindow visible=$xdwindow.visible? if visible==true command = "_xdhighlight('#{p}')" $xdwindow.execute_script(command) else UI.messagebox('Open the 4D Objects window to highlight') end else UI.messagebox('Open the 4D Objects window to highlight') end }
Basically this all goes fine. When the html link is clicked in webdialog1, something happens in webdialog2
But from there on, when i click another SU entity the content of webdialog1 is not updated anymore.
Hope the information here helps.Thx!
Advertisement