Class: Bookmarks

Qv.Document.Bookmarks

The Bookmarks object.
Example
var myBookmarkRenderer = {};
var MyDoc;
var MyBookmarks;
var MySelect;

myBookmarkRenderer.Paint = function () {
    
    MyBookmarks = MyDoc.Bookmarks().BookMarks;

    //Set the number of items in the drop down to the number of bookmarks
    MySelect.options.length = MyBookmarks.length;

    //loop through each bookmark
    for (var i = 0; i < MyBookmarks.length; i++) {
        var option = MySelect.options[i];
        option.text = MyBookmarks[i].text;
        option.value = MyBookmarks[i].value;
    }
}

Init = function () {
    //References a HTML dropdown control
    MySelect = document.getElementById("bmks");

    MyDoc = Qv.GetDocument('FilmsWebView');

    //If there's a change to the bookmarks, then myBookmarkRenderer will run
    MyDoc.AddBookmarkPaint(myBookmarkRenderer);    
}

function applyBookmark() {
    //Get the bookmark's id from the selected item in the drop down
    MyDoc.Bookmarks().SelectBookmark(MySelect.options[MySelect.selectedIndex].value);
    
    //Alternatively, you can pass the bookmark id
    //MyDoc.Bookmarks().SelectBookmark("Document\BM01");
}

function createBookmark() {
    var bookmarkName = MyBookMarkName.value;
    MyDoc.Bookmarks().NewBookmark("my bookmark",false,true,false,false,
                                    false,true,"shows sales trends in USA",false);
}

function deleteBookmark() {
    //Get the bookmark's id from the selected item in the drop down
    MyDoc.Bookmarks().DeleteBookmark(MySelect.options[MySelect.selectedIndex].value);
    
    //Alternatively, you can pass the bookmark id
    //MyDoc.Bookmarks().DeleteBookmark("Document\BM01");
}

Qv.InitWorkBench(
{ 
    View: 'FilmsWebView', 
    BodyOnLoadFunctionNames: ['Init'] 
});

Methods

DeleteBookmark(id)

Delete a bookmark with the given bookmark id.
Parameters:
Name Type Description
id String The id of the bookmark you want to delete.
Example
var MyDoc = Qv.GetDocument("FilmsWebView");
    MyDoc.Bookmarks().DeleteBookmark("Document\BM01");

NewBookmark(name, additive, share, excludeselections, layoutstate, hide, showpopupinfo, infomsg, inputfieldvaluesflag)

Create a new bookmark
Parameters:
Name Type Description
name String Name of the bookmark.
additive Boolean The bookmark is applied on top of any previous selections (no clear).
share Boolean Share the bookmark with other users.
excludeselections Boolean Exclude the selections made in the application.
layoutstate Boolean Include state of all objects.
hide Boolean The bookmark is not displayed in the bookmark list but is still selectable in code or via url.
showpopupinfo Boolean The bookmark description will be shown in a message when the bookmark is selected.
infomsg String Description of the bookmark.
inputfieldvaluesflag Boolean Include values in input fields.
Example
var bookmarkName = MyBookMarkName.value;
    MyDoc.Bookmarks().NewBookmark("my bookmark",false,true,false,false,
    false,true,"shows sales trends in USA",false);

SelectBookmark(id)

Apply a bookmark.
Parameters:
Name Type Description
id String The id of the bookmark you want to apply.
Example
var MyDoc = Qv.GetDocument("FilmsWebView");
    MyDoc.Bookmarks().SelectBookmark("Document\BM01");