2
votes

I'm using a view control to display a notes view. We are also using a search function, to search the first column of each view. As we want to save the search parameter a user has entered, we've created a bean saving the search key for each user.

To save the seach key, we are using this code in the data > keys property of a view control:

var dbName:String = database.getFilePath();
var viewName:String = "vwCurrentRequests";
var searchValue:String = searchUserBean.getSearchValue(dbName+viewName);

if(searchValue.isEmpty() || searchValue==null) {
    return "";
} else {
    return searchValue;
}

But we always have to define the viewName value for each view. So the question is: How can we get the view name of the current view?

1
Also look here: xpageswiki.com/web/youatnotes/wiki-xpages.nsf/dx/…. Hence your code is in data source property, try to get reference from "this" keyword. - Frantisek Kossuth

1 Answers

3
votes

You can access the name of the view with this SSJS code:

getComponent("viewPanel1").getData().getViewName()

viewPanel1 is the id of your view panel.

EDIT:

As Frantisek Kossuth wrote, you can use the this keyword instead of the getComponent.

this.getData().getViewName()