Add View DataSource in SSJS


/**
 * Injects a view datasource on a page.
 * @param dbName - name of a database
 * @param viewName - name of a view
 * @param varName - name of a datasource
 * @return a new datasource (DominoViewData)
 */
function addViewDataSource(dbName: string, viewName: string, varName: string) {
    var v = new com.ibm.xsp.model.domino.DominoViewData();
    v.setDatabaseName(dbName);
    v.setViewName(viewName);
    v.setVar(varName);
    v.setComponent(getView());
    getView().addData(v);
    return v;
}
All code submitted to OpenNTF XSnippets, whether submitted as a "Snippet" or in the body of a Comment, is provided under the Apache License Version 2.0. See Terms of Use for full details.
No comments yetLogin first to comment...