X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/3789b528d8dd8aad4558e38e22d775bcab1cbd36..f562e4c6e5fac7bcb445985b99acbea4d706e6f0:/src/form/field/Trigger.js diff --git a/src/form/field/Trigger.js b/src/form/field/Trigger.js index ae7f900e..ae4a9b5e 100644 --- a/src/form/field/Trigger.js +++ b/src/form/field/Trigger.js @@ -1,58 +1,65 @@ -/** - * @class Ext.form.field.Trigger - * @extends Ext.form.field.Text - *

Provides a convenient wrapper for TextFields that adds a clickable trigger button (looks like a combobox by default). - * The trigger has no default action, so you must assign a function to implement the trigger click handler by - * overriding {@link #onTriggerClick}. You can create a Trigger field directly, as it renders exactly like a combobox - * for which you can provide a custom implementation. - * {@img Ext.form.field.Trigger/Ext.form.field.Trigger.png Ext.form.field.Trigger component} - * For example:

- *

-Ext.define('Ext.ux.CustomTrigger', {
-    extend: 'Ext.form.field.Trigger',
-    alias: 'widget.customtrigger',
-    
-    // override onTriggerClick
-    onTriggerClick: function() {
-        Ext.Msg.alert('Status', 'You clicked my trigger!');
-    }
-});
+/*
 
-Ext.create('Ext.form.FormPanel', {
-    title: 'Form with TriggerField',
-    bodyPadding: 5,
-    width: 350,
-    renderTo: Ext.getBody(),
-    items:[{
-        xtype: 'customtrigger',
-        fieldLabel: 'Sample Trigger',
-        emptyText: 'click the trigger',
-    }]
-});
-
+This file is part of Ext JS 4 + +Copyright (c) 2011 Sencha Inc + +Contact: http://www.sencha.com/contact + +GNU General Public License Usage +This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file. Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html. + +If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact. + +*/ +/** + * Provides a convenient wrapper for TextFields that adds a clickable trigger button (looks like a combobox by default). + * The trigger has no default action, so you must assign a function to implement the trigger click handler by overriding + * {@link #onTriggerClick}. You can create a Trigger field directly, as it renders exactly like a combobox for which you + * can provide a custom implementation. * - *

However, in general you will most likely want to use Trigger as the base class for a reusable component. - * {@link Ext.form.field.Date} and {@link Ext.form.field.ComboBox} are perfect examples of this.

+ * For example: * - * @constructor - * Create a new Trigger field. - * @param {Object} config Configuration options (valid {@Ext.form.field.Text} config options will also be applied - * to the base Text field) - * @xtype triggerfield + * @example + * Ext.define('Ext.ux.CustomTrigger', { + * extend: 'Ext.form.field.Trigger', + * alias: 'widget.customtrigger', + * + * // override onTriggerClick + * onTriggerClick: function() { + * Ext.Msg.alert('Status', 'You clicked my trigger!'); + * } + * }); + * + * Ext.create('Ext.form.FormPanel', { + * title: 'Form with TriggerField', + * bodyPadding: 5, + * width: 350, + * renderTo: Ext.getBody(), + * items:[{ + * xtype: 'customtrigger', + * fieldLabel: 'Sample Trigger', + * emptyText: 'click the trigger', + * }] + * }); + * + * However, in general you will most likely want to use Trigger as the base class for a reusable component. + * {@link Ext.form.field.Date} and {@link Ext.form.field.ComboBox} are perfect examples of this. */ Ext.define('Ext.form.field.Trigger', { extend:'Ext.form.field.Text', alias: ['widget.triggerfield', 'widget.trigger'], - requires: ['Ext.core.DomHelper', 'Ext.util.ClickRepeater', 'Ext.layout.component.field.Trigger'], + requires: ['Ext.DomHelper', 'Ext.util.ClickRepeater', 'Ext.layout.component.field.Trigger'], alternateClassName: ['Ext.form.TriggerField', 'Ext.form.TwinTriggerField', 'Ext.form.Trigger'], + // note: {id} here is really {inputId}, but {cmpId} is available fieldSubTpl: [ 'name="{name}" ', 'size="{size}" ', 'tabIndex="{tabIdx}" ', 'class="{fieldCls} {typeCls}" autocomplete="off" />', - '