Sınıf Seçici Oluşturucu
Koleksiyonlar ile düzeninizi koruyun
İçeriği tercihlerinize göre kaydedin ve kategorilere ayırın.
PickerBuilder
, Picker
nesneleri oluşturmak için kullanılır. Aksi belirtilmedikçe, aşağıdaki yöntemlerin döndürdüğü tür PickerBuilder
'tür. Bu, bir çağrıyı diğerinin ardından zincirlemenize olanak tanır.
Örnekler
Oluşturucu kalıbını kullanarak temel bir Picker
oluşturun.
const picker = new google.pickerPickerBuilder()
.setOAuthToken('TOKEN_FOR_USER')
.setAppId('1234567890') // Cloud Project number
.addView(google.picker.ViewId.DOCS)
.setCallback((data) => {
console.log(data);
})
.build();
İmza
export class PickerBuilder
Ayrıntılar
Yöntemler
Ad |
Açıklama |
addView(viewOrViewId) |
Gezinme bölmesine bir görünüm ekleyin. |
addViewGroup(viewGroup) |
Üst düzey gezinme bölmesine bir ViewGroup ekleyin. |
build() |
Seçici nesnesini oluşturun. |
disableFeature(feature) |
Bir seçici özelliğini devre dışı bırakma |
enableFeature(feature) |
Seçici özelliğini etkinleştirin. |
getRelayUrl() |
gadgets.rpc için kullanılan geçiş URL'sini alın. |
getTitle() |
İletişim kutusunun başlığını alın. |
hideTitleBar() |
Başlık çubuğunun gösterilmesini devre dışı bırakın. Yeniden etkinleştirmek için boş olmayan bir başlıkla setTitle veya undefined numaralı telefonu arayın. |
isFeatureEnabled(feature) |
Seçicinin Feature etkin olup olmadığını kontrol edin. |
setAppId(appId) |
Kullanıcının dosyalarına Drive API aracılığıyla erişmesi gereken uygulamanın kimliğini ayarlar. |
setCallback(method) |
Geri çağırma yöntemini ayarlayın. Bu yöntem, kullanıcı öğeleri seçtiğinde veya iptal ettiğinde çağrılır. Geri çağırma yöntemi tek bir geri çağırma nesnesi alır. Geri çağırma nesnesinin yapısı JSON Kılavuzu'nda açıklanmaktadır. |
setDeveloperKey(key) |
Google Developers Console'dan alınan Tarayıcı API anahtarını ayarlar. Tarayıcı API anahtarının nasıl alınacağıyla ilgili ayrıntılar için Geliştirici Kılavuzu'na bakın. |
setDocument(document) |
Dokümanı ayarlayın. |
setLocale(locale) |
Seçicinin yerel ayarını belirleyin. Yerel ayar, ISO 639 dil kodudur. Dil desteklenmiyorsa en-US kullanılır. |
setMaxItems(max) |
Kullanıcının seçebileceği maksimum öğe sayısını ayarlar. |
setOAuthToken(token) |
Mevcut kullanıcının kimliğini doğrulamak için kullanılacak bir OAuth jetonu ayarlar. |
setOrigin(origin) |
Seçici iletişim kutusunun kaynağını ayarlar. Uygulamanız bir iframe'de çalışıyorsa kaynak, en üstteki sayfanın window.location.protocol + '//' + window.location.host olarak ayarlanmalıdır. |
setRelayUrl(url) |
gadgets.rpc için kullanılan geçiş URL'sini ayarlayın. |
setSelectableMimeTypes(type) |
Seçilebilir MIME türlerinin listesini ayarlayın. Birden fazla MIME türü gerekiyorsa bunları ayırmak için virgül kullanın. MIME türlerini ayarlamazsanız görünümde tüm MIME türlerine ait dosyalar görüntülenir. |
setSize(width, height) |
Tercih edilen iletişim kutusu boyutunu ayarlayın. İletişim kutusu otomatik olarak ortalanır. Minimum boyutu (566.350), maksimum boyutu ise (1051.650)'tir. |
setTitle(title) |
İletişim başlığını ayarlayın. |
toUri() |
Bu oluşturucu tarafından oluşturulan URI'yi döndürür. |
Aksi belirtilmediği sürece bu sayfanın içeriği Creative Commons Atıf 4.0 Lisansı altında ve kod örnekleri Apache 2.0 Lisansı altında lisanslanmıştır. Ayrıntılı bilgi için Google Developers Site Politikaları'na göz atın. Java, Oracle ve/veya satış ortaklarının tescilli ticari markasıdır.
Son güncelleme tarihi: 2025-07-25 UTC.
[null,null,["Son güncelleme tarihi: 2025-07-25 UTC."],[],[],null,["# Class PickerBuilder\n\n`PickerBuilder` is used to create `Picker` objects. Except where noted\notherwise, the return type of methods below is of type `PickerBuilder`, allowing\nyou to chain one call after another.\n\nExamples\n--------\n\nBuild a basic `Picker` using the builder pattern. \n\n const picker = new google.pickerPickerBuilder()\n .setOAuthToken('TOKEN_FOR_USER')\n .setAppId('1234567890') // Cloud Project number\n .addView(google.picker.ViewId.DOCS)\n .setCallback((data) =\u003e {\n console.log(data);\n })\n .build();\n\nSignature\n---------\n\n export class PickerBuilder\n\nDetails\n-------\n\n| Final | No |\n|-------|----|\n\nMethods\n-------\n\n| Name | Description |\n|---------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [`addView(viewOrViewId)`](./picker.pickerbuilder.addview) | Add a view to the navigation pane. |\n| [`addViewGroup(viewGroup)`](./picker.pickerbuilder.addviewgroup) | Add a ViewGroup to the top-level navigation pane. |\n| [`build()`](./picker.pickerbuilder.build) | Construct the Picker object. |\n| [`disableFeature(feature)`](./picker.pickerbuilder.disablefeature) | Disable a picker feature. |\n| [`enableFeature(feature)`](./picker.pickerbuilder.enablefeature) | Enable a picker feature. |\n| [`getRelayUrl()`](./picker.pickerbuilder.getrelayurl) | Get the relay URL, used for gadgets.rpc. |\n| [`getTitle()`](./picker.pickerbuilder.gettitle) | Get the dialog title. |\n| [`hideTitleBar()`](./picker.pickerbuilder.hidetitlebar) | Disable the title bar from being shown. To re-enable, call `setTitle` with a non-empty title or `undefined`. |\n| [`isFeatureEnabled(feature)`](./picker.pickerbuilder.isfeatureenabled) | Check if a picker `Feature` is enabled. |\n| [`setAppId(appId)`](./picker.pickerbuilder.setappid) | Sets the Id of the application needing to access the user's files via the [`Drive API`](/workspace/drive/api). |\n| [`setCallback(method)`](./picker.pickerbuilder.setcallback) | Set the callback method. This method is called when the user selects items or cancels. The callback method receives a single callback object. The structure of the callback object is described in the [JSON Guide](/workspace/drive/picker/reference/results). |\n| [`setDeveloperKey(key)`](./picker.pickerbuilder.setdeveloperkey) | Sets the Browser API key obtained from Google Developers Console. See the Developer's Guide for details on how to obtain the Browser API key. |\n| [`setDocument(document)`](./picker.pickerbuilder.setdocument) | Set the document. |\n| [`setLocale(locale)`](./picker.pickerbuilder.setlocale) | Set the locale for the picker. The locale is an ISO 639 language code. If the language is not supported, en-US is used. |\n| [`setMaxItems(max)`](./picker.pickerbuilder.setmaxitems) | Sets the maximum number of items a user can pick. |\n| [`setOAuthToken(token)`](./picker.pickerbuilder.setoauthtoken) | Sets an OAuth token to use for authenticating the current user. |\n| [`setOrigin(origin)`](./picker.pickerbuilder.setorigin) | Sets the origin of picker dialog. The origin should be set to the window.location.protocol + '//' + window.location.host of the top-most page, if your application is running in an iframe. |\n| [`setRelayUrl(url)`](./picker.pickerbuilder.setrelayurl) | Set the relay URL, used for gadgets.rpc. |\n| [`setSelectableMimeTypes(type)`](./picker.pickerbuilder.setselectablemimetypes) | Set the list of MIME types which will be selectable. Use commas to separate MIME types if more than one is required. If you don't set MIME types, files of all MIME types are displayed in the view. |\n| [`setSize(width, height)`](./picker.pickerbuilder.setsize) | Set the preferred dialog size. The dialog will be auto-centered. It has a minimum size of (566,350) and a maximum size of (1051,650). |\n| [`setTitle(title)`](./picker.pickerbuilder.settitle) | Set the dialog title. |\n| [`toUri()`](./picker.pickerbuilder.touri) | Returns the URI generated by this builder. |"]]