Export (0) Print
Expand All

Vwa.VwaControl.hideCustomMessage Method

apps for Office and SharePoint

Last modified: August 06, 2011

Applies to: apps for SharePoint | SharePoint Server 2013

Hides the custom developer-provided HTML error message and re-enables interaction with the currently rendered Web Drawing page.

var value = VwaControl.hideCustomMessage()

Void Returns nothing.

For more information about how to add a Visio Web Access Web Part to a SharePoint Web Parts page, see Customizing Visio Web Drawings in the Visio Web Access Web Part.

The following example displays the Web Part ID of the Visio Web Access Web Part and the URL of the Web Drawing displayed in the Web Part.

<script type="text/javascript">

// Hook into the AJAX Sys.Application.load event.
Sys.Application.add_load(onApplicationLoad)

// Define global variables.
var vwaControl; 
var webPartElementID;

// Capture a reference to the current session of the Visio Web Access Web Part.
function onApplicationLoad() {
    try{
            webPartElementID = getVWAWebPartID();
            vwaControl= new Vwa.VwaControl(webPartElementID);
            vwaControl.addHandler("diagramcomplete", onDiagramComplete);
    }
    catch(err){
        alert(err);
    }
}

// Search the SharePoint page to get the WebPartID# for the Visio Web Access Web Part.
function getVWAWebPartID() {
    
    // Get a NodesList of all the div tags on the page. 
    var divArray = document.getElementsByTagName("div");
    var webPartElementID;
    
    // Iterate through the NodesList to get the node with the class attribute "VisioWebAccess."
    for (var i = 0; i < divArray.length; i++) {
        var node = divArray[i];
        
        // Return the first instance of the Visio Web Access Web Part.
        if (node.className == "VisioWebAccess") {
            webPartElementID = node.parentNode.parentNode.id;
            break;
        }
    }
    return webPartElementID;
}

// Capture references to global variables.
function onDiagramComplete() {
    try{
        // Get the URL for the drawing currently displayed in the Visio Web Access Web Part.
        var drawingURL = vwaControl.getDiagramUrl();
        
        // Display a custom message with the Visio Web Access Web Part ID and drawing URL.
        vwaControl.displayCustomMessage(
            "<b>Visio Web Access Web Part ID is:</b> " + webPartElementID + "<br>" +
            "<b>Diagram was loaded from:</b> " + drawingURL + "<br><br>" +
            "<a href='javascript:hideMessage()'>" + 
            "Click here to dismiss this message<\/a>");
    }
    catch(err){
        alert(err);
    }
}

// Hide the message when the user is done with it.
function hideMessage(){
    try{
        vwaControl.hideCustomMessage();
    }
    catch(err){
        alert(err);
    }
}

</script>

Show:
© 2014 Microsoft