X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/6746dc89c47ed01b165cc1152533605f97eb8e8d..f562e4c6e5fac7bcb445985b99acbea4d706e6f0:/src/form/field/Trigger.js diff --git a/src/form/field/Trigger.js b/src/form/field/Trigger.js index 841d9522..ae4a9b5e 100644 --- a/src/form/field/Trigger.js +++ b/src/form/field/Trigger.js @@ -13,59 +13,53 @@ If you are unsure which license is appropriate for your use, please contact the */ /** - * @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',
-    }]
-});
-
+ * 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. + * + * For example: + * + * @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!'); + * } + * }); * - *

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.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', + * }] + * }); * - * @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) + * 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" />', - '