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

    This function allows you to trigger a function of your own when the thumbnails order has been changed (ie. the pages have been reordered).

    RegisterOnThumbnailsOrderChanged: function (docuViewareID, callback)


    The identifier for the DocuVieware™ instance.
    The function you want to execute on event.
    The callback provides an argument having a prototype { source, destination }.
    - source is an array that contains the page number (or page numbers in case of multiple selection) that have been moved.
    - destination is the position the selection has been moved to.

    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 RegisterOnThumbnailsOrderChangedOnDocuViewareAPIReady() {
        if (typeof DocuViewareAPI !== "undefined" && DocuViewareAPI.IsInitialized("DocuVieware1")) {
            DocuViewareAPI.RegisterOnThumbnailsOrderChanged("DocuVieware1", function (data) {
                console.log(data.source + " has been moved to " + data.destination);
        else {
            setTimeout(function () { RegisterOnThumbnailsOrderChangedOnDocuViewareAPIReady() }, 10);
    document.addEventListener("DOMContentLoaded", function () {
    }, false);