Ext.Action.html
22.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
<div class="body-wrap">
<div class="top-tools">
<a class="inner-link" href="#Ext.Action-props"><img src="../resources/images/default/s_wev8.gif" class="item-icon icon-prop">Properties</a>
<a class="inner-link" href="#Ext.Action-methods"><img src="../resources/images/default/s_wev8.gif" class="item-icon icon-method">Methods</a>
<a class="inner-link" href="#Ext.Action-events"><img src="../resources/images/default/s_wev8.gif" class="item-icon icon-event">Events</a>
<a class="inner-link" href="#Ext.Action-configs"><img src="../resources/images/default/s_wev8.gif" class="item-icon icon-config">Config Options</a>
<a class="bookmark" href="../docs/?class=Ext.Action"><img src="../resources/images/default/s_wev8.gif" class="item-icon icon-fav">Direct Link</a>
</div>
<h1>Class Ext.Action</h1>
<table cellspacing="0">
<tr><td class="label">Package:</td><td class="hd-info">Ext</td></tr>
<tr><td class="label">Defined In:</td><td class="hd-info"><a href="../source/widgets/Action_wev8.js" target="_blank">Action_wev8.js</a></td></tr>
<tr><td class="label">Class:</td><td class="hd-info">Action</td></tr>
<tr><td class="label">Extends:</td><td class="hd-info">Object</td></tr>
</table>
<div class="description">
<p>An Action is a piece of reusable functionality that can be abstracted out of any particular component so that it
can be usefully shared among multiple components. Actions let you share handlers, configuration options and UI
updates across any components that support the Action interface (primarily <a ext:cls="Ext.Toolbar" href="output/Ext.Toolbar.html">Ext.Toolbar</a>, <a ext:cls="Ext.Button" href="output/Ext.Button.html">Ext.Button</a>
and <a ext:cls="Ext.menu.Menu" href="output/Ext.menu.Menu.html">Ext.menu.Menu</a> components).</p>
<p>Aside from supporting the config object interface, any component that needs to use Actions must also support
the following method list, as these will be called as needed by the Action class: setText(string), setIconCls(string),
setDisabled(boolean), setVisible(boolean) and setHandler(function).</p>
Example usage:<br>
<pre><code><i>// Define the shared action. Each component below will have the same</i>
<i>// display text and icon, and will display the same message on click.</i>
<b>var</b> action = <b>new</b> Ext.Action({
text: <em>'Do something'</em>,
handler: <b>function</b>(){
Ext.Msg.alert(<em>'Click'</em>, <em>'You did something.'</em>);
},
iconCls: <em>'<b>do</b>-something'</em>
});
<b>var</b> panel = <b>new</b> Ext.Panel({
title: <em>'Actions'</em>,
width:500,
height:300,
tbar: [
<i>// Add the action directly to a toolbar as a menu button</i>
action, {
text: <em>'Action Menu'</em>,
<i>// Add the action to a menu as a text item</i>
menu: [action]
}
],
items: [
<i>// Add the action to the panel body as a standard button</i>
<b>new</b> Ext.Button(action)
],
renderTo: Ext.getBody()
});
<i>// Change the text <b>for</b> all components using the action</i>
action.setText(<em>'Something <b>else</b>'</em>);</code></pre> </div>
<div class="hr"></div>
<a id="Ext.Action-configs"></a>
<h2>Config Options</h2>
<table cellspacing="0" class="member-table">
<tr>
<th class="sig-header" colspan="2">Config Options</th>
<th class="msource-header">Defined By</th>
</tr>
<tr class="config-row">
<td class="micon"><a class="exi" href="#expand"> </a></td>
<td class="sig">
<a id="Ext.Action-disabled"></a>
<b>disabled</b> : Boolean <div class="mdesc">
True to disable all components using this action, false to enable them (defaults to false). </div>
</td>
<td class="msource">Action</td>
</tr>
<tr class="config-row alt expandable">
<td class="micon"><a class="exi" href="#expand"> </a></td>
<td class="sig">
<a id="Ext.Action-handler"></a>
<b>handler</b> : Function <div class="mdesc">
<div class="short">The function that will be invoked by each component tied to this action when the component's primary event is trigger...</div>
<div class="long">
The function that will be invoked by each component tied to this action when the component's primary event is triggered (defaults to undefined). </div>
</div>
</td>
<td class="msource">Action</td>
</tr>
<tr class="config-row">
<td class="micon"><a class="exi" href="#expand"> </a></td>
<td class="sig">
<a id="Ext.Action-hidden"></a>
<b>hidden</b> : Boolean <div class="mdesc">
True to hide all components using this action, false to show them (defaults to false). </div>
</td>
<td class="msource">Action</td>
</tr>
<tr class="config-row alt expandable">
<td class="micon"><a class="exi" href="#expand"> </a></td>
<td class="sig">
<a id="Ext.Action-iconCls"></a>
<b>iconCls</b> : String <div class="mdesc">
<div class="short">The icon CSS class for all components using this action (defaults to ''). The class should supply a background image ...</div>
<div class="long">
The icon CSS class for all components using this action (defaults to ''). The class should supply a background image that will be used as the icon image. </div>
</div>
</td>
<td class="msource">Action</td>
</tr>
<tr class="config-row">
<td class="micon"><a class="exi" href="#expand"> </a></td>
<td class="sig">
<a id="Ext.Action-scope"></a>
<b>scope</b> : Object <div class="mdesc">
The scope in which the <a ext:cls="Ext.Action" ext:member="handler" href="output/Ext.Action.html#handler">handler</a> function will execute. </div>
</td>
<td class="msource">Action</td>
</tr>
<tr class="config-row alt">
<td class="micon"><a class="exi" href="#expand"> </a></td>
<td class="sig">
<a id="Ext.Action-text"></a>
<b>text</b> : String <div class="mdesc">
The text to set for all components using this action (defaults to ''). </div>
</td>
<td class="msource">Action</td>
</tr>
</table>
<a id="Ext.Action-props"></a>
<h2>Public Properties</h2>
<table cellspacing="0" class="member-table">
<tr>
<th class="sig-header" colspan="2">Property</th>
<th class="msource-header">Defined By</th>
</tr>
<tr class="property-row">
<td class="micon"><a class="exi" href="#expand"> </a></td>
<td class="sig">
<a id="Ext.Action-isDisabled"></a>
<b>isDisabled</b> : Object <div class="mdesc">
Returns true if the components using this action are currently disabled, else returns false. Read-only. </div>
</td>
<td class="msource">Action</td>
</tr>
<tr class="property-row alt">
<td class="micon"><a class="exi" href="#expand"> </a></td>
<td class="sig">
<a id="Ext.Action-isHidden"></a>
<b>isHidden</b> : Object <div class="mdesc">
Returns true if the components using this action are currently hidden, else returns false. Read-only. </div>
</td>
<td class="msource">Action</td>
</tr>
</table>
<a id="Ext.Action-methods"></a>
<h2>Public Methods</h2>
<table cellspacing="0" class="member-table">
<tr>
<th class="sig-header" colspan="2">Method</th>
<th class="msource-header">Defined By</th>
</tr>
<tr class="method-row expandable">
<td class="micon"><a class="exi" href="#expand"> </a></td>
<td class="sig">
<a id="Ext.Action-Action"></a>
<b>Action</b>( <code>Object config</code> ) <div class="mdesc">
<div class="short"></div>
<div class="long">
<div class="mdetail-params">
<strong>Parameters:</strong>
<ul><li><code>config</code> : Object<div class="sub-desc">The configuration options</div></li> </ul>
<strong>Returns:</strong>
<ul>
<li><code></code></li>
</ul>
</div>
</div>
</div>
</td>
<td class="msource">Action</td>
</tr>
<tr class="method-row alt expandable">
<td class="micon"><a class="exi" href="#expand"> </a></td>
<td class="sig">
<a id="Ext.Action-disable"></a>
<b>disable</b>() : void <div class="mdesc">
<div class="short">Disables all components using this action.</div>
<div class="long">
Disables all components using this action. <div class="mdetail-params">
<strong>Parameters:</strong>
<ul><li>None.</li> </ul>
<strong>Returns:</strong>
<ul>
<li><code>void</code></li>
</ul>
</div>
</div>
</div>
</td>
<td class="msource">Action</td>
</tr>
<tr class="method-row expandable">
<td class="micon"><a class="exi" href="#expand"> </a></td>
<td class="sig">
<a id="Ext.Action-each"></a>
<b>each</b>( <code>Function fn</code>, <code>Object scope</code> ) : void <div class="mdesc">
<div class="short">Executes the specified function once for each component currently tied to this action. The function passed
in should...</div>
<div class="long">
Executes the specified function once for each component currently tied to this action. The function passed
in should accept a single argument that will be an object that supports the basic Action config/method interface. <div class="mdetail-params">
<strong>Parameters:</strong>
<ul><li><code>fn</code> : Function<div class="sub-desc">The function to execute for each component</div></li><li><code>scope</code> : Object<div class="sub-desc">The scope in which the function will execute</div></li> </ul>
<strong>Returns:</strong>
<ul>
<li><code>void</code></li>
</ul>
</div>
</div>
</div>
</td>
<td class="msource">Action</td>
</tr>
<tr class="method-row alt expandable">
<td class="micon"><a class="exi" href="#expand"> </a></td>
<td class="sig">
<a id="Ext.Action-enable"></a>
<b>enable</b>() : void <div class="mdesc">
<div class="short">Enables all components using this action.</div>
<div class="long">
Enables all components using this action. <div class="mdetail-params">
<strong>Parameters:</strong>
<ul><li>None.</li> </ul>
<strong>Returns:</strong>
<ul>
<li><code>void</code></li>
</ul>
</div>
</div>
</div>
</td>
<td class="msource">Action</td>
</tr>
<tr class="method-row expandable">
<td class="micon"><a class="exi" href="#expand"> </a></td>
<td class="sig">
<a id="Ext.Action-execute"></a>
<b>execute</b>( <span class="optional" title="Optional">[<code>Mixed arg1</code>]</span>, <span class="optional" title="Optional">[<code>Mixed arg2</code>]</span>, <span class="optional" title="Optional">[<code>Mixed etc...</code>]</span> ) : void <div class="mdesc">
<div class="short">Executes this action manually using the default handler specified in the original config object. Any arguments
passe...</div>
<div class="long">
Executes this action manually using the default handler specified in the original config object. Any arguments
passed to this function will be passed on to the handler function. <div class="mdetail-params">
<strong>Parameters:</strong>
<ul><li><code>arg1</code> : Mixed<div class="sub-desc">(optional) Variable number of arguments passed to the handler function</div></li><li><code>arg2</code> : Mixed<div class="sub-desc">(optional)</div></li><li><code>etc...</code> : Mixed<div class="sub-desc">(optional)</div></li> </ul>
<strong>Returns:</strong>
<ul>
<li><code>void</code></li>
</ul>
</div>
</div>
</div>
</td>
<td class="msource">Action</td>
</tr>
<tr class="method-row alt expandable">
<td class="micon"><a class="exi" href="#expand"> </a></td>
<td class="sig">
<a id="Ext.Action-getIconClass"></a>
<b>getIconClass</b>() : void <div class="mdesc">
<div class="short">Gets the icon CSS class currently used by all components using this action.</div>
<div class="long">
Gets the icon CSS class currently used by all components using this action. <div class="mdetail-params">
<strong>Parameters:</strong>
<ul><li>None.</li> </ul>
<strong>Returns:</strong>
<ul>
<li><code>void</code></li>
</ul>
</div>
</div>
</div>
</td>
<td class="msource">Action</td>
</tr>
<tr class="method-row expandable">
<td class="micon"><a class="exi" href="#expand"> </a></td>
<td class="sig">
<a id="Ext.Action-getText"></a>
<b>getText</b>() : void <div class="mdesc">
<div class="short">Gets the text currently displayed by all components using this action.</div>
<div class="long">
Gets the text currently displayed by all components using this action. <div class="mdetail-params">
<strong>Parameters:</strong>
<ul><li>None.</li> </ul>
<strong>Returns:</strong>
<ul>
<li><code>void</code></li>
</ul>
</div>
</div>
</div>
</td>
<td class="msource">Action</td>
</tr>
<tr class="method-row alt expandable">
<td class="micon"><a class="exi" href="#expand"> </a></td>
<td class="sig">
<a id="Ext.Action-hide"></a>
<b>hide</b>() : void <div class="mdesc">
<div class="short">Hides all components using this action.</div>
<div class="long">
Hides all components using this action. <div class="mdetail-params">
<strong>Parameters:</strong>
<ul><li>None.</li> </ul>
<strong>Returns:</strong>
<ul>
<li><code>void</code></li>
</ul>
</div>
</div>
</div>
</td>
<td class="msource">Action</td>
</tr>
<tr class="method-row expandable">
<td class="micon"><a class="exi" href="#expand"> </a></td>
<td class="sig">
<a id="Ext.Action-setDisabled"></a>
<b>setDisabled</b>( <code>Boolean disabled</code> ) : void <div class="mdesc">
<div class="short">Sets the disabled state of all components using this action. Shortcut method
for <a ext:cls="Ext.Action" ext:member="enable" href="output/Ext.Action.html#enable">enable</a> and <a ext:cls="Ext.Action" ext:member="disable" href="output/Ext.Action.html#disable">disable</a>.</div>
<div class="long">
Sets the disabled state of all components using this action. Shortcut method
for <a ext:cls="Ext.Action" ext:member="enable" href="output/Ext.Action.html#enable">enable</a> and <a ext:cls="Ext.Action" ext:member="disable" href="output/Ext.Action.html#disable">disable</a>. <div class="mdetail-params">
<strong>Parameters:</strong>
<ul><li><code>disabled</code> : Boolean<div class="sub-desc">True to disable the component, false to enable it</div></li> </ul>
<strong>Returns:</strong>
<ul>
<li><code>void</code></li>
</ul>
</div>
</div>
</div>
</td>
<td class="msource">Action</td>
</tr>
<tr class="method-row alt expandable">
<td class="micon"><a class="exi" href="#expand"> </a></td>
<td class="sig">
<a id="Ext.Action-setHandler"></a>
<b>setHandler</b>( <code>Function fn</code>, <code>Object scope</code> ) : void <div class="mdesc">
<div class="short">Sets the function that will be called by each component using this action when its primary event is triggered.</div>
<div class="long">
Sets the function that will be called by each component using this action when its primary event is triggered. <div class="mdetail-params">
<strong>Parameters:</strong>
<ul><li><code>fn</code> : Function<div class="sub-desc">The function that will be invoked by the action's components. The function
will be called with no arguments.</div></li><li><code>scope</code> : Object<div class="sub-desc">The scope in which the function will execute</div></li> </ul>
<strong>Returns:</strong>
<ul>
<li><code>void</code></li>
</ul>
</div>
</div>
</div>
</td>
<td class="msource">Action</td>
</tr>
<tr class="method-row expandable">
<td class="micon"><a class="exi" href="#expand"> </a></td>
<td class="sig">
<a id="Ext.Action-setHidden"></a>
<b>setHidden</b>( <code>Boolean hidden</code> ) : void <div class="mdesc">
<div class="short">Sets the hidden state of all components using this action. Shortcut method
for <a ext:cls="Ext.Action" ext:member="hide" href="output/Ext.Action.html#hide">hide</a> and <a ext:cls="Ext.Action" ext:member="show" href="output/Ext.Action.html#show">show</a>.</div>
<div class="long">
Sets the hidden state of all components using this action. Shortcut method
for <a ext:cls="Ext.Action" ext:member="hide" href="output/Ext.Action.html#hide">hide</a> and <a ext:cls="Ext.Action" ext:member="show" href="output/Ext.Action.html#show">show</a>. <div class="mdetail-params">
<strong>Parameters:</strong>
<ul><li><code>hidden</code> : Boolean<div class="sub-desc">True to hide the component, false to show it</div></li> </ul>
<strong>Returns:</strong>
<ul>
<li><code>void</code></li>
</ul>
</div>
</div>
</div>
</td>
<td class="msource">Action</td>
</tr>
<tr class="method-row alt expandable">
<td class="micon"><a class="exi" href="#expand"> </a></td>
<td class="sig">
<a id="Ext.Action-setIconClass"></a>
<b>setIconClass</b>( <code>String cls</code> ) : void <div class="mdesc">
<div class="short">Sets the icon CSS class for all components using this action. The class should supply
a background image that will b...</div>
<div class="long">
Sets the icon CSS class for all components using this action. The class should supply
a background image that will be used as the icon image. <div class="mdetail-params">
<strong>Parameters:</strong>
<ul><li><code>cls</code> : String<div class="sub-desc">The CSS class supplying the icon image</div></li> </ul>
<strong>Returns:</strong>
<ul>
<li><code>void</code></li>
</ul>
</div>
</div>
</div>
</td>
<td class="msource">Action</td>
</tr>
<tr class="method-row expandable">
<td class="micon"><a class="exi" href="#expand"> </a></td>
<td class="sig">
<a id="Ext.Action-setText"></a>
<b>setText</b>( <code>String text</code> ) : void <div class="mdesc">
<div class="short">Sets the text to be displayed by all components using this action.</div>
<div class="long">
Sets the text to be displayed by all components using this action. <div class="mdetail-params">
<strong>Parameters:</strong>
<ul><li><code>text</code> : String<div class="sub-desc">The text to display</div></li> </ul>
<strong>Returns:</strong>
<ul>
<li><code>void</code></li>
</ul>
</div>
</div>
</div>
</td>
<td class="msource">Action</td>
</tr>
<tr class="method-row alt expandable">
<td class="micon"><a class="exi" href="#expand"> </a></td>
<td class="sig">
<a id="Ext.Action-show"></a>
<b>show</b>() : void <div class="mdesc">
<div class="short">Shows all components using this action.</div>
<div class="long">
Shows all components using this action. <div class="mdetail-params">
<strong>Parameters:</strong>
<ul><li>None.</li> </ul>
<strong>Returns:</strong>
<ul>
<li><code>void</code></li>
</ul>
</div>
</div>
</div>
</td>
<td class="msource">Action</td>
</tr>
</table>
<a id="Ext.Action-events"></a>
<h2>Public Events</h2>
<div class="no-members">This class has no public events.</div>
</div>