Reference Guide
Reference Guides / JavaScript API / Events / RegisterOnSearchSnapInSelected
In This Topic
    RegisterOnSearchSnapInSelected
    In This Topic
     RegisterOnSearchSnapInSelected

    This function allows you to trigger a function of your own when the built-in Search Snap-In is selected.

    RegisterOnSearchSnapInSelected: function (docuViewareID, callback)

    Parameters

    docuViewareID
    The identifier for the DocuVieware™ instance.
    callback
    The function you want to execute on event.

    Return Value

    1 if error.

    Example of usage

    This JavaScript makes sure the DocuVieware control is properly loaded and initialized and then subscribes to the event on load.

    function RegisterOnSearchSnapInSelectedOnDocuViewareAPIReady() {
        if (typeof DocuViewareAPI !== "undefined" && DocuViewareAPI.IsInitialized("DocuVieware1")) {
            DocuViewareAPI.RegisterOnSearchSnapInSelected("DocuVieware1", function () { console.log("search snap-in selected"); });
        }
        else {
            setTimeout(function () { RegisterOnSearchSnapInSelectedOnDocuViewareAPIReady() }, 10);
        }
    }
    document.addEventListener("DOMContentLoaded", function () {
        RegisterOnSearchSnapInSelectedOnDocuViewareAPIReady();
    }, false);