Class PickerBuilder
संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
PickerBuilder
का इस्तेमाल Picker
ऑब्जेक्ट बनाने के लिए किया जाता है. जहां कुछ और नहीं बताया गया है वहां, नीचे दिए गए तरीकों का रिटर्न टाइप PickerBuilder
होता है. इससे आपको एक के बाद एक कॉल करने की अनुमति मिलती है.
उदाहरण
बिल्डर पैटर्न का इस्तेमाल करके, बुनियादी Picker
बनाएं.
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();
हस्ताक्षर
export class PickerBuilder
विवरण
तरीके
नाम |
ब्यौरा |
addView(viewOrViewId) |
नेविगेशन पैनल में कोई व्यू जोड़ें. |
addViewGroup(viewGroup) |
टॉप लेवल नेविगेशन पैनल में ViewGroup जोड़ें. |
build() |
पिकर ऑब्जेक्ट बनाएं. |
disableFeature(feature) |
पिकर की सुविधा बंद करना. |
enableFeature(feature) |
पिकर की सुविधा चालू करें. |
getRelayUrl() |
गैजेट.rpc के लिए इस्तेमाल किए गए रिले यूआरएल को पाएं. |
getTitle() |
डायलॉग बॉक्स का टाइटल पाएं. |
hideTitleBar() |
टाइटल बार को दिखने से रोकें. फिर से चालू करने के लिए, ऐसे टाइटल के साथ setTitle पर कॉल करें जो खाली न हो या undefined . |
isFeatureEnabled(feature) |
देखें कि कोई पिकर Feature चालू है या नहीं. |
setAppId(appId) |
Drive API के ज़रिए, उपयोगकर्ता की फ़ाइलों को ऐक्सेस करने वाले ऐप्लिकेशन का आईडी सेट करता है. |
setCallback(method) |
कॉलबैक का तरीका सेट करें. जब उपयोगकर्ता आइटम चुनता है या रद्द करता है, तब इस तरीके को कॉल किया जाता है. कॉलबैक तरीके को एक कॉलबैक ऑब्जेक्ट मिलता है. कॉलबैक ऑब्जेक्ट के स्ट्रक्चर के बारे में JSON गाइड में बताया गया है. |
setDeveloperKey(key) |
Google Developers Console से मिली Browser API पासकोड सेट करता है. Browser API पासकोड पाने का तरीका जानने के लिए, डेवलपर गाइड देखें. |
setDocument(document) |
दस्तावेज़ सेट करें. |
setLocale(locale) |
पिकर के लिए स्थानीय भाषा सेट करें. स्थान एक ISO 639 भाषा कोड है. अगर भाषा काम नहीं करती है, तो en-US का इस्तेमाल किया जाता है. |
setMaxItems(max) |
इससे यह तय होता है कि उपयोगकर्ता ज़्यादा से ज़्यादा कितने आइटम चुन सकता है. |
setOAuthToken(token) |
यह मौजूदा उपयोगकर्ता की पुष्टि करने के लिए एक OAuth टोकन सेट करता है. |
setOrigin(origin) |
पिकर डायलॉग का ऑरिजिन सेट करता है. अगर आपका ऐप्लिकेशन किसी iframe में चल रहा है, तो ऑरिजिन को सबसे ऊपर मौजूद पेज के window.location.protocol + '//' + window.location.host पर सेट किया जाना चाहिए. |
setRelayUrl(url) |
gadgets.rpc के लिए इस्तेमाल किया जाने वाला रिले यूआरएल सेट करें. |
setSelectableMimeTypes(type) |
ऐसे MIME टाइप की सूची सेट करें जिन्हें चुना जा सकेगा. अगर एक से ज़्यादा MIME टाइप की ज़रूरत है, तो उन्हें अलग करने के लिए कॉमा का इस्तेमाल करें. अगर आपने MIME टाइप सेट नहीं किए हैं, तो व्यू में सभी MIME टाइप की फ़ाइलें दिखती हैं. |
setSize(width, height) |
डायलॉग के लिए पसंदीदा साइज़ सेट करें. डायलॉग अपने-आप बीच में दिखेगा. इसका साइज़ कम से कम (5,66,350) और ज़्यादा से ज़्यादा (1,051,650) होना चाहिए. |
setTitle(title) |
डायलॉग का टाइटल सेट करें. |
toUri() |
इस बिल्डर से जनरेट किया गया यूआरआई दिखाता है. |
जब तक कुछ अलग से न बताया जाए, तब तक इस पेज की सामग्री को Creative Commons Attribution 4.0 License के तहत और कोड के नमूनों को Apache 2.0 License के तहत लाइसेंस मिला है. ज़्यादा जानकारी के लिए, Google Developers साइट नीतियां देखें. Oracle और/या इससे जुड़ी हुई कंपनियों का, Java एक रजिस्टर किया हुआ ट्रेडमार्क है.
आखिरी बार 2025-07-25 (UTC) को अपडेट किया गया.
[null,null,["आखिरी बार 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. |"]]