setCurrentView (Client API reference)

Sets the current view.

Grid types supported

Read-only grid

Syntax

viewSelector.setCurrentView(object);

Parameter

Name Type Required Description
object Lookup object Yes Specify the Lookup object that has the following values:
- entityType: Number. The object type code for the SavedQuery (1039) or UserQuery (4230) that represents the view the user can select.
- id: String. The Id for the view the user can select.
- name: String. The name of the view the user can select.

Remarks

If the subgrid control is not configured to display the view selector, calling this method on the viewSelector object will throw an error.

To get the viewSelector object, see ViewSelector.

Example

function setView(executionContext) {
    var ContactsIFollow = {
        entityType: 1039, // SavedQuery
        id: "3A282DA1-5D90-E011-95AE-00155D9CFA02",
        name: "Contacts I Follow"
    }
    // Get the gridContext
    var formContext = executionContext.getFormContext();
    var gridContext = formContext.getControl("Contacts");

    // Set the view using ContactsIFollow
    gridContext.getViewSelector().setCurrentView(ContactsIFollow);
}

ViewSelector