Klasa: konstruktor

Zespół

Monter

new Builder()

Przykład

// Builds a results container.
function onload() {
  gapi.client.init({
    'apiKey': '<your api key>',
    'clientId': '<your client id>',
    // Add additional scopes if needed
    'scope': 'https://www.googleapis.com/auth/cloud_search.query',
    'hosted_domain': '<your G Suite domain>',
  });

  const resultscontainer =
      new gapi.cloudsearch.widget.resultscontainer.Builder()
        .setSearchResultsContainerElement(document.getElementById('search_result'))
        .build();

  const searchBox = new gapi.cloudsearch.widget.searchbox.Builder()
    .setInput(document.getElementById('input'))
    .setAnchor(document.getElementById('input').parentElement)
    .setResultsContainer(resultscontainer);
    .build();
}
gapi.load('client:cloudsearch-widget', onload);

Metody

kompilacja

build() zwraca ResultsContainer

Tworzy kontener wyników.

Akcje powrotne

non-null ResultsContainer 

setAdapter

setAdapter(adapter) zwraca Konstruktor.

Opcjonalnie. Ustawia adapter tak, by dostosować środowisko użytkownika.

Parametr

adapter

ResultsContainerAdapter

Wartość nie może być wartością null.

Akcje powrotne

non-null Builder to

setFacetResultsContainerElement

setFacetResultsContainerElement(facetResultsContainerElement) zwraca konstruktora

Ustawia element kontenera dla wyników aspektów. Musi być prawidłowym elementem, który może zawierać węzły podrzędne.

Parametr

facetResultsContainerElement

Element

Wartość nie może być wartością null.

Akcje powrotne

non-null Builder to

setIncludePagination

setIncludePagination(includePagination) zwraca narzędzie tworzące.

Opcjonalnie. Wartość domyślna to prawda. Jeśli zasada ma wartość Prawda, w kontenerze wyników wyświetla się domyślny interfejs podziału na strony.

Parametr

includePagination

boolean

Akcje powrotne

non-null Builder to

setResultsContainer

setResultsContainer(resultsContainer) zwraca narzędzie tworzące

Wymagany. Ustawia element kontenera. Musi być prawidłowym elementem, który może zawierać węzły podrzędne.

Parametr

resultsContainer

Element

Wartość nie może być wartością null.

Wycofano
Akcje powrotne

non-null Builder to

setSearchApplicationId

setSearchApplicationId(searchApplicationId) zwraca narzędzie tworzące.

Opcjonalnie. Ustawia identyfikator wyszukiwarki, który ma być używany dla żądań. Musi być poprzedzony ciągiem „searchapplications/”.

Parametr

searchApplicationId

ciąg znaków

Akcje powrotne

non-null Builder to

setSearchResultsContainerElement

setSearchResultsContainerElement(searchResultsContainerElement) zwraca konstruktora

Wymagany. Ustawia element kontenera. Musi być prawidłowym elementem, który może zawierać węzły podrzędne.

Parametr

searchResultsContainerElement

Element

Wartość nie może być wartością null.

Akcje powrotne

non-null Builder to