Checks whether or not the specified object exists in the array.
The object to check for
Removes the specified object from the array. If the object is not found nothing happens.
The object to remove
The date parsing and format syntax is a subset of
<a href="http://www.php.net/date">PHP's date() function</a>, and the formats that are
supported will provide results equivalent to their PHP versions.
The following is a list of all currently supported formats:
<pre>Format Description Example returned values
------ ----------------------------------------------------------------------- -----------------------
d Day of the month, 2 digits with leading zeros 01 to 31
D A short textual representation of the day of the week Mon to Sun
j Day of the month without leading zeros 1 to 31
l A full textual representation of the day of the week Sunday to Saturday
N ISO-8601 numeric representation of the day of the week 1 (for Monday) through 7 (for Sunday)
S English ordinal suffix for the day of the month, 2 characters st, nd, rd or th. Works well with j
w Numeric representation of the day of the week 0 (for Sunday) to 6 (for Saturday)
z The day of the year (starting from 0) 0 to 364 (365 in leap years)
W ISO-8601 week number of year, weeks starting on Monday 01 to 53
F A full textual representation of a month, such as January or March January to December
m Numeric representation of a month, with leading zeros 01 to 12
M A short textual representation of a month Jan to Dec
n Numeric representation of a month, without leading zeros 1 to 12
t Number of days in the given month 28 to 31
L Whether it's a leap year 1 if it is a leap year, 0 otherwise.
o ISO-8601 year number (identical to (Y), but if the ISO week number (W) Examples: 1998 or 2004
belongs to the previous or next year, that year is used instead)
Y A full numeric representation of a year, 4 digits Examples: 1999 or 2003
y A two digit representation of a year Examples: 99 or 03
a Lowercase Ante meridiem and Post meridiem am or pm
A Uppercase Ante meridiem and Post meridiem AM or PM
g 12-hour format of an hour without leading zeros 1 to 12
G 24-hour format of an hour without leading zeros 0 to 23
h 12-hour format of an hour with leading zeros 01 to 12
H 24-hour format of an hour with leading zeros 00 to 23
i Minutes, with leading zeros 00 to 59
s Seconds, with leading zeros 00 to 59
u Milliseconds, with leading zeroes (arbitrary number of digits allowed) Examples:
001 (i.e. 1ms) or
100 (i.e. 100ms) or
999 (i.e. 999ms) or
999876543210 (i.e. 999.876543210ms)
O Difference to Greenwich time (GMT) in hours and minutes Example: +1030
P Difference to Greenwich time (GMT) with colon between hours and minutes Example: -08:00
T Timezone abbreviation of the machine running the code Examples: EST, MDT, PDT ...
Z Timezone offset in seconds (negative if west of UTC, positive if east) -43200 to 50400
c ISO 8601 date (note: milliseconds, if present, must be specified with Examples:
at least 1 digit. There is no limit to how many digits the millisecond 2007-04-17T15:19:21+08:00 or
value may contain. see http://www.w3.org/TR/NOTE-datetime for more info) 2008-03-16T16:18:22Z or
2009-02-15T17:17:23.9+01:00 or
2010-01-14T18:16:24,999876543-07:00
U Seconds since the Unix Epoch (January 1 1970 00:00:00 GMT) 1193432466 or -2138434463</pre>
Example usage (note that you must escape format specifiers with '\\' to render them as character literals):
<pre><code>// Sample date:
// 'Wed Jan 10 2007 15:05:01 GMT-0600 (Central Standard Time)'
var dt = new Date('1/10/2007 03:05:01 PM GMT-0600');
document.write(dt.format('Y-m-d')); // 2007-01-10
document.write(dt.format('F j, Y, g:i a')); // January 10, 2007, 3:05 pm
document.write(dt.format('l, \\t\\he jS \\of F Y h:i:s A')); // Wednesday, the 10th of January 2007 03:05:01 PM</code></pre>
Here are some standard date/time patterns that you might find helpful. They
are not part of the source of Date.js, but to use them you can simply copy this
block of code into any script that is included after Date.js and they will also become
globally available on the Date object. Feel free to add or remove patterns as needed in your code.
<pre><code>Date.patterns = {
ISO8601Long:"Y-m-d H:i:s",
ISO8601Short:"Y-m-d",
ShortDate: "n/j/Y",
LongDate: "l, F d, Y",
FullDateTime: "l, F d, Y g:i:s A",
MonthDay: "F d",
ShortTime: "g:i A",
LongTime: "g:i:s A",
SortableDateTime: "Y-m-d\\TH:i:s",
UniversalSortableDateTime: "Y-m-d H:i:sO",
YearMonth: "F, Y"
};</code></pre>
Example usage:
<pre><code>var dt = new Date();
document.write(dt.format(Date.patterns.ShortDate));</code></pre>
<static> Date interval constant
<static> Date interval constant
<static> Date interval constant
<static> Date interval constant
<static> Date interval constant
<static> Date interval constant
<static> Date interval constant
<static> An array of textual day names.
Override these values for international dates.
Example:
<pre><code>Date.dayNames = [
'SundayInYourLang',
'MondayInYourLang',
...
];</code></pre>
<static> An array of textual month names.
Override these values for international dates.
Example:
<pre><code>Date.monthNames = [
'JanInYourLang',
'FebInYourLang',
...
];</code></pre>
<static> An object hash of zero-based javascript month numbers (with short month names as keys. note: keys are case-sensitive).
Override these values for international dates.
Example:
<pre><code>Date.monthNumbers = {
'ShortJanNameInYourLang':0,
'ShortFebNameInYourLang':1,
...
};</code></pre>
<static> The base format-code to formatting-function hashmap used by the <a ext:cls="Date" ext:member="format" href="output/Date.html#format">format</a> method.
Formatting functions are strings (or functions which return strings) which
will return the appropriate value when evaluated in the context of the Date object
from which the <a ext:cls="Date" ext:member="format" href="output/Date.html#format">format</a> method is called.
Add to / override these mappings for custom date formatting.
Note: Date.format() treats characters as literals if an appropriate mapping cannot be found.
Example:
<pre><code>Date.formatCodes.x = "String.leftPad(this.getDate(), 2, '0')";
(new Date()).format("X"); // returns the current day of the month</code></pre>
<static> Get the short month name for the given month number.
Override this function for international dates.
A zero-based javascript month number.
<static> Get the short day name for the given day number.
Override this function for international dates.
A zero-based javascript day number.
<static> Get the zero-based javascript month number for the given short/full month name.
Override this function for international dates.
The short/full month name.
<static> Parses the passed string using the specified format. Note that this function expects dates in normal calendar
format, meaning that months are 1-based (1 = January) and not zero-based like in JavaScript dates. Any part of
the date format that is not specified will default to the current date value for that part. Time parts can also
be specified, but default to 0. Keep in mind that the input date string must precisely match the specified format
string or the parse operation will fail.
Example Usage:
<pre><code>//dt = Fri May 25 2007 (current date)
var dt = new Date();
//dt = Thu May 25 2006 (today's month/day in 2006)
dt = Date.parseDate("2006", "Y");
//dt = Sun Jan 15 2006 (all date parts specified)
dt = Date.parseDate("2006-01-15", "Y-m-d");
//dt = Sun Jan 15 2006 15:20:01 GMT-0600 (CST)
dt = Date.parseDate("2006-01-15 3:20:01 PM", "Y-m-d h:i:s A" );</code></pre>
The unparsed date as a string.
The format the date is in.
Get the timezone abbreviation of the current date (equivalent to the format specifier 'T').
Note: The date string returned by the javascript Date object's toString() method varies
between browsers (e.g. FF vs IE) and system region settings (e.g. IE in Asia vs IE in America).
For a given date string e.g. "Thu Oct 25 2007 22:55:35 GMT+0800 (Malay Peninsula Standard Time)",
getTimezone() first tries to get the timezone abbreviation from between a pair of parentheses
(which may or may not be present), failing which it proceeds to get the timezone abbreviation
from the GMT offset portion of the date string.
Get the offset from GMT of the current date (equivalent to the format specifier 'O').
true to separate the hours and minutes with a colon (defaults to false).
Get the numeric day number of the year, adjusted for leap year.
Get the numeric ISO-8601 week number of the year.
(equivalent to the format specifier 'W', but without a leading zero).
Whether or not the current date is in a leap year.
Get the first day of the current month, adjusted for leap year. The returned value
is the numeric day index within the week (0-6) which can be used in conjunction with
the <a ext:cls="Date" ext:member="monthNames" href="output/Date.html#monthNames">monthNames</a> array to retrieve the textual day name.
Example:
<pre><code>var dt = new Date('1/10/2007');
document.write(Date.dayNames[dt.getFirstDayOfMonth()]); //output: 'Monday'</code></pre>
Get the last day of the current month, adjusted for leap year. The returned value
is the numeric day index within the week (0-6) which can be used in conjunction with
the <a ext:cls="Date" ext:member="monthNames" href="output/Date.html#monthNames">monthNames</a> array to retrieve the textual day name.
Example:
<pre><code>var dt = new Date('1/10/2007');
document.write(Date.dayNames[dt.getLastDayOfMonth()]); //output: 'Wednesday'</code></pre>
Get the date of the first day of the month in which this date resides.
Get the date of the last day of the month in which this date resides.
Get the number of days in the current month, adjusted for leap year.
Get the English ordinal suffix of the current day (equivalent to the format specifier 'S').
Creates and returns a new Date instance with the exact same date value as the called instance.
Dates are copied and passed by reference, so if a copied date variable is modified later, the original
variable will also be changed. When the intention is to create a new variable that will not
modify the original instance, you should create a clone.
Example of correctly cloning a date:
<pre><code>//wrong way:
var orig = new Date('10/1/2006');
var copy = orig;
copy.setDate(5);
document.write(orig); //returns 'Thu Oct 05 2006'!
//correct way:
var orig = new Date('10/1/2006');
var copy = orig.clone();
copy.setDate(5);
document.write(orig); //returns 'Thu Oct 01 2006'</code></pre>
Clears any time information from this date.
true to create a clone of this date, clear the time and return it (defaults to false).
Provides a convenient method of performing basic date arithmetic. This method
does not modify the Date instance being called - it creates and returns
a new Date instance containing the resulting date value.
Examples:
<pre><code>//Basic usage:
var dt = new Date('10/29/2006').add(Date.DAY, 5);
document.write(dt); //returns 'Fri Oct 06 2006 00:00:00'
//Negative values will subtract correctly:
var dt2 = new Date('10/1/2006').add(Date.DAY, -5);
document.write(dt2); //returns 'Tue Sep 26 2006 00:00:00'
//You can even chain several calls together in one line!
var dt3 = new Date('10/1/2006').add(Date.DAY, 5).add(Date.HOUR, 8).add(Date.MINUTE, -30);
document.write(dt3); //returns 'Fri Oct 06 2006 07:30:00'</code></pre>
A valid date interval enum value.
The amount to add to the current date.
Checks if this date falls on or between the given start and end dates.
Start date
End date
Formats a date given the supplied format string.
The format string.
Returns the number of milliseconds between this date and date
(optional) Defaults to now
apf core utilities and functions.<br><br><i>This class is a singleton and cannot be created directly.</i>
True if the browser is in strict (standards-compliant) mode, as opposed to quirks mode
True if the page is running over SSL
True when the document is fully initialized and ready for action
True to automatically uncache orphaned apf.Elements periodically (defaults to true)
True to automatically purge event listeners after uncaching an element (defaults to false).
Note: this only happens if enableGarbageCollector is true.
URL to a blank file used by apf when in secure mode for iframe src and onReady src to prevent
the IE insecure content warning (defaults to javascript:false).
URL to a 1x1 transparent gif image used by apf to create inline icons with CSS background images. (Defaults to
"http://extjs.com/s.gif" and you should change this to a URL on your server).
A reusable empty function
True if the detected browser is Opera.
True if the detected browser is Safari.
True if the detected browser is Safari 3.x.
True if the detected browser is Safari 2.x.
True if the detected browser is Internet Explorer.
True if the detected browser is Internet Explorer 6.x.
True if the detected browser is Internet Explorer 7.x.
True if the detected browser uses the Gecko layout engine (e.g. Mozilla, Firefox).
True if the detected browser uses a pre-Gecko 1.9 layout engine (e.g. Firefox 2.x).
True if the detected browser uses a Gecko 1.9+ layout engine (e.g. Firefox 3.x).
True if the detected browser is Internet Explorer running in non-strict mode.
True if the detected platform is Linux.
True if the detected platform is Windows.
True if the detected platform is Mac OS.
True if the detected platform is Adobe Air.
By default, apf intelligently decides whether floating elements should be shimmed. If you are using flash,
you may want to set this to true.
Copies all the properties of config to obj if they don't already exist.
The receiver of the properties
The source of the properties
Applies event listeners to elements by selectors when the document is ready.
The event name is specified with an @ suffix.
<pre><code>apf.addBehaviors({
// add a listener for click on all anchors in element with id foo
'#foo a@click' : function(e, t){
// do something
},
// add the same listener to multiple selectors (separated by comma BEFORE the @)
'#foo a, #bar span.some-class@mouseover' : function(){
// do something
}
});</code></pre>
The list of behaviors to apply
Generates unique ids. If the element already has an id, it is unchanged
(optional) The element to generate an id for
(optional) Id prefix (defaults "ext-gen")
apfends one class with another class and optionally overrides members with the passed literal. This class
also adds the function "override()" to the class that can be used to override
members on an instance.
<p>
This function also supports a 2-argument call in which the subclass's constructor is
not passed as an argument. In this form, the parameters are as follows:</p><p>
<div class="mdetail-params"><ul>
<li><code>superclass</code>
<div class="sub-desc">The class being extended</div></li>
<li><code>overrides</code>
<div class="sub-desc">A literal with members which are copied into the subclass's
prototype, and are therefore shared among all instances of the new class.<p>
This may contain a special member named <tt><b>constructor</b></tt>. This is used
to define the constructor of the new class, and is returned. If this property is
<i>not</i> specified, a constructor is generated and returned which just calls the
superclass's constructor passing on its parameters.</p></div></li>
</ul></div></p><p>
For example, to create a subclass of the apf GridPanel:
<pre><code>MyGridPanel = apf.extend(apf.grid.GridPanel, {
constructor: function(config) {
// Your preprocessing here
MyGridPanel.superclass.constructor.apply(this, arguments);
// Your postprocessing here
},
yourMethod: function() {
// etc.
}
});</code></pre>
</p>
The class inheriting the functionality
The class being extended
(optional) A literal with members which are copied into the subclass's
prototype, and are therefore shared between all instances of the new class.
Adds a list of functions to the prototype of an existing class, overwriting any existing methods with the same name.
Usage:<pre><code>apf.override(MyClass, {
newMethod1: function(){
// etc.
},
newMethod2: function(foo){
// etc.
}
});</code></pre>
The class to override
The list of functions to add to origClass. This should be specified as an object literal
containing one or more methods.
Creates namespaces to be used for scoping variables and classes so that they are not global. Usage:
<pre><code>apf.namespace('Company', 'Company.data');
Company.Widget = function() { ... }
Company.data.CustomStore = function(config) { ... }</code></pre>
Takes an object and converts it to an encoded URL. e.g. apf.urlEncode({foo: 1, bar: 2}); would return "foo=1&bar=2". Optionally, property values can be arrays, instead of keys and the resulting string that's returned will contain a name/value pair for each array value.
Takes an encoded URL and and converts it to an object. e.g. apf.urlDecode("foo=1&bar=2"); would return {foo: 1, bar: 2} or apf.urlDecode("foo=1&bar=2&bar=3&bar=4", true); would return {foo: 1, bar: [2, 3, 4]}.
(optional) Items of the same name will overwrite previous values instead of creating an an array (Defaults to false).
Iterates an array calling the passed function with each item, stopping if your function returns false. If the
passed array is not really an array, your function is called once with it.
The supplied function is called with (Object item, Number index, Array allItems).
Escapes the passed string for use in a regular expression
Return the dom node for the passed string (id), dom node, or apf.Element
Returns the current HTML document object as an <a ext:cls="apf.Element" href="output/apf.Element.html">apf.Element</a>.
Returns the current document body as an <a ext:cls="apf.Element" href="output/apf.Element.html">apf.Element</a>.
Shorthand for <a ext:cls="apf.ComponentMgr" ext:member="get" href="output/apf.ComponentMgr.html#get">apf.ComponentMgr.get</a>
Utility method for validating that a value is numeric, returning the specified default value if it is not.
Should be a number, but any type will be handled appropriately
The value to return if the original value is non-numeric
Attempts to destroy any objects passed to it by removing all event listeners, removing them from the
DOM (if applicable) and calling their destroy functions (if available). This method is primarily
intended for arguments of type <a ext:cls="apf.Element" href="output/apf.Element.html">apf.Element</a> and <a ext:cls="apf.Component" href="output/apf.Component.html">apf.Component</a>, but any subclass of
<a ext:cls="apf.util.Observable" href="output/apf.util.Observable.html">apf.util.Observable</a> can be passed in. Any number of elements and/or components can be
passed into this function in a single call as separate arguments.
An <a ext:cls="apf.Element" href="output/apf.Element.html">apf.Element</a> or <a ext:cls="apf.Component" href="output/apf.Component.html">apf.Component</a> to destroy
(optional)
(optional)
Removes a DOM node from the document. The body node will be ignored if passed in.
The node to remove
Returns the type of object that is passed in. If the object passed in is null or undefined it
return false otherwise it returns one of the following values:<ul>
<li><b>string</b>: If the object passed is a string</li>
<li><b>number</b>: If the object passed is a number</li>
<li><b>boolean</b>: If the object passed is a boolean value</li>
<li><b>function</b>: If the object passed is a function reference</li>
<li><b>object</b>: If the object passed is an object</li>
<li><b>array</b>: If the object passed is an array</li>
<li><b>regexp</b>: If the object passed is a regular expression</li>
<li><b>element</b>: If the object passed is a DOM Element</li>
<li><b>nodelist</b>: If the object passed is a DOM NodeList</li>
<li><b>textnode</b>: If the object passed is a DOM text node and contains something other than whitespace</li>
<li><b>whitespace</b>: If the object passed is a DOM text node and contains only whitespace</li>
Returns true if the passed value is null, undefined or an empty string (optional).
The value to test
(optional) Pass true if an empty string is not considered empty
Returns true if the passed object is a JavaScript array, otherwise false.
object to test
Returns true if the passed object is a JavaScript date object, otherwise false.
object to test
Selects elements based on the passed CSS selector to enable working on them as 1.
The CSS selector or an array of elements
(optional) true to create a unique apf.Element for each element (defaults to a shared flyweight object)
(optional) The root element of the query or id of the root
Selects an array of DOM nodes by CSS/XPath selector. Shorthand of <a ext:cls="apf.DomQuery" ext:member="select" href="output/apf.DomQuery.html#select">apf.DomQuery.select</a>
The selector/xpath query
(optional) The start of the query (defaults to document).
Static method to retrieve Element objects. Uses simple caching to consistently return the same object.
Automatically fixes if an object was recreated with the same id via AJAX or DOM.
Shorthand of <a ext:cls="apf.Element" ext:member="get" href="output/apf.Element.html#get">apf.Element.get</a>
The id of the node, a DOM Node or an existing Element.
<static> Gets the globally shared flyweight Element, with the passed node as the active element. Do not store a reference to this element -
the dom node can be overwritten by other code.
Shorthand of <a ext:cls="apf.Element" ext:member="fly" href="output/apf.Element.html#fly">apf.Element.fly</a>
The dom node or id
(optional) Allows for creation of named reusable flyweights to
prevent conflicts (e.g. internally apf uses "_internal")
Fires when the document is ready (before onload and before images are loaded). Shorthand of <a ext:cls="apf.EventManager" ext:member="onDocumentReady" href="output/apf.EventManager.html#onDocumentReady">apf.EventManager.onDocumentReady</a>.
The method the event invokes
An object that becomes the scope of the handler
If true, the obj passed in becomes
the execution scope of the listener
Copies all the properties of config to obj.
The receiver of the properties
The source of the properties
A different object that will also be applied for default values
Shorthand for <a ext:cls="apf.util.JSON" ext:member="encode" href="output/apf.util.JSON.html#encode">apf.util.JSON.encode</a>
The variable to encode
Shorthand for <a ext:cls="apf.util.JSON" ext:member="decode" href="output/apf.util.JSON.html#decode">apf.util.JSON.decode</a>
The JSON string
Shorthand for <a ext:cls="apf.ComponentMgr" ext:member="registerType" href="output/apf.ComponentMgr.html#registerType">apf.ComponentMgr.registerType</a>
The mnemonic string by which the Component class
may be looked up.
The new Component class.
<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="apf.Toolbar" href="output/apf.Toolbar.html">apf.Toolbar</a>, <a ext:cls="apf.Button" href="output/apf.Button.html">apf.Button</a>
and <a ext:cls="apf.menu.Menu" href="output/apf.menu.Menu.html">apf.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>// Define the shared action. Each component below will have the same
// display text and icon, and will display the same message on click.
var action = new apf.Action({
text: 'Do something',
handler: function(){
apf.Msg.alert('Click', 'You did something.');
},
iconCls: 'do-something'
});
var panel = new apf.Panel({
title: 'Actions',
width:500,
height:300,
tbar: [
// Add the action directly to a toolbar as a menu button
action, {
text: 'Action Menu',
// Add the action to a menu as a text item
menu: [action]
}
],
items: [
// Add the action to the panel body as a standard button
new apf.Button(action)
],
renderTo: apf.getBody()
});
// Change the text for all components using the action
action.setText('Something else');</code></pre>
The configuration options
Returns true if the components using this action are currently disabled, else returns false. Read-only.
Returns true if the components using this action are currently hidden, else returns false. Read-only.
Sets the text to be displayed by all components using this action.
The text to display
Gets the text currently displayed by all components using this action.
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.
The CSS class supplying the icon image
Gets the icon CSS class currently used by all components using this action.
Sets the disabled state of all components using this action. Shortcut method
for <a ext:cls="apf.Action" ext:member="enable" href="output/apf.Action.html#enable">enable</a> and <a ext:cls="apf.Action" ext:member="disable" href="output/apf.Action.html#disable">disable</a>.
True to disable the component, false to enable it
Enables all components using this action.
Disables all components using this action.
Sets the hidden state of all components using this action. Shortcut method
for <a ext:cls="apf.Action" ext:member="hide" href="output/apf.Action.html#hide">hide</a> and <a ext:cls="apf.Action" ext:member="show" href="output/apf.Action.html#show">show</a>.
True to hide the component, false to show it
Shows all components using this action.
Hides all components using this action.
Sets the function that will be called by each component using this action when its primary event is triggered.
The function that will be invoked by the action's components. The function
will be called with no arguments.
The scope in which the function will execute
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.
The function to execute for each component
The scope in which the function will execute
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.
(optional) Variable number of arguments passed to the handler function
(optional)
(optional)
Global Ajax request class. Provides a simple way to make Ajax requests with maximum flexibility. Example usage:
<pre><code>// Basic request
apf.Ajax.request({
url: 'foo.php',
success: someFn,
failure: otherFn,
headers: {
'my-header': 'foo'
},
params: { foo: 'bar' }
});
// Simple ajax form submission
apf.Ajax.request({
form: 'some-form',
params: 'foo=bar'
});
// Default headers to pass in every request
apf.Ajax.defaultHeaders = {
'Powered-By': 'apf'
};
// Global Ajax events can be handled on every request!
apf.Ajax.on('beforerequest', this.showSpinner, this);</code></pre><br><br><i>This class is a singleton and cannot be created directly.</i>
True to add a unique cache-buster param to GET requests. (defaults to true)
The default URL to be used for requests to the server. (defaults to undefined)
An object containing properties which are used as
extra parameters to each request made by this object. (defaults to undefined)
An object containing request headers which are added to each request made by this object. (defaults to undefined)
The default HTTP method to be used for requests. Note that this is case-sensitive and should be all caps (defaults
to undefined; if not set but parms are present will use "POST," otherwise "GET.")
The timeout in milliseconds to be used for requests. (defaults to 30000)
Whether a new request should abort any pending requests. (defaults to false)
Serialize the passed form into a url encoded string
Base class for any visual <a ext:cls="apf.Component" href="output/apf.Component.html">apf.Component</a> that uses a box container. BoxComponent provides automatic box
model adjustments for sizing and positioning and will work correctly withnin the Component rendering model. All
container classes should subclass BoxComponent so that they will work consistently when nested within other apf
layout containers.
The configuration options.
Sets the width and height of the component. This method fires the <a ext:cls="apf.BoxComponent" ext:member="resize" href="output/apf.BoxComponent.html#resize">resize</a> event. This method can accept
either width and height as separate numeric arguments, or you can pass a size object like {width:10, height:20}.
The new width to set, or a size object in the format {width, height}
The new height to set (not required if a size object is passed as the first arg)
Sets the width of the component. This method fires the <a ext:cls="apf.BoxComponent" ext:member="resize" href="output/apf.BoxComponent.html#resize">resize</a> event.
The new width to set
Sets the height of the component. This method fires the <a ext:cls="apf.BoxComponent" ext:member="resize" href="output/apf.BoxComponent.html#resize">resize</a> event.
The new height to set
Gets the current size of the component's underlying element.
Gets the current XY position of the component's underlying element.
(optional) If true the element's left and top are returned instead of page XY (defaults to false)
Gets the current box measurements of the component's underlying element.
(optional) If true the element's left and top are returned instead of page XY (defaults to false)
Sets the current box measurements of the component's underlying element.
An object in the format {x, y, width, height}
Sets the left and top of the component. To set the page XY position instead, use <a ext:cls="apf.BoxComponent" ext:member="setPagePosition" href="output/apf.BoxComponent.html#setPagePosition">setPagePosition</a>.
This method fires the <a ext:cls="apf.BoxComponent" ext:member="move" href="output/apf.BoxComponent.html#move">move</a> event.
The new left
The new top
Sets the page XY position of the component. To set the left and top instead, use <a ext:cls="apf.BoxComponent" ext:member="setPosition" href="output/apf.BoxComponent.html#setPosition">setPosition</a>.
This method fires the <a ext:cls="apf.BoxComponent" ext:member="move" href="output/apf.BoxComponent.html#move">move</a> event.
The new x position
The new y position
Force the component's size to recalculate based on the underlying element's current height and width.
Simple Button class
Create a new button
The config object
Read-only. True if this button is hidden
Read-only. True if this button is disabled
Read-only. True if this button is pressed (only if enableToggle = true)
The Button's owner <a ext:cls="apf.Panel" href="output/apf.Panel.html">apf.Panel</a> (defaults to undefined, and is set automatically when
the Button is added to a container). Read-only.
Sets the CSS class that provides a background image to use as the button's icon. This method also changes
the value of the <a ext:cls="iconCls" href="output/iconCls.html">iconCls</a> config internally.
The CSS class providing the icon image
Assigns this button's click handler
The function to call when the button is clicked
(optional) Scope for the function passed in
Sets this button's text
The button text
Gets the text for this button
If a state it passed, it becomes the pressed state otherwise the current state is toggled.
(optional) Force a particular state
Focus the button
Show this button's menu (if it has one)
Hide this button's menu (if it has one)
Returns true if the button has a menu and it is visible
Simple color palette class for choosing colors. The palette can be rendered to any container.<br />
Here's an example of typical usage:
<pre><code>var cp = new apf.ColorPalette({value:'993300'}); // initial selected color
cp.render('my-div');
cp.on('select', function(palette, selColor){
// do something with selColor
});</code></pre>
Create a new ColorPalette
The config object
<p>An array of 6-digit color hex code strings (without the # symbol). This array can contain any number
of colors, and each hex code should be unique. The width of the palette is controlled via CSS by adjusting
the width property of the 'x-color-palette' class (or assigning a custom class), so you can balance the number
of colors with the width setting until the box is symmetrical.</p>
<p>You can override individual colors if needed:</p>
<pre><code>var cp = new apf.ColorPalette();
cp.colors[0] = "FF0000"; // change the first box to red</code></pre>
Or you can provide a custom array of your own for complete control:
<pre><code>var cp = new apf.ColorPalette();
cp.colors = ["000000", "993300", "333300"];</code></pre>
Selects the specified color in the palette (fires the <a ext:cls="apf.ColorPalette" ext:member="select" href="output/apf.ColorPalette.html#select">select</a> event)
A valid 6-digit color hex code (# will be stripped if included)
<p>Base class for all apf components. All subclasses of Component can automatically participate in the standard
apf component lifecycle of creation, rendering and destruction. They also have automatic support for basic hide/show
and enable/disable behavior. Component allows any subclass to be lazy-rendered into any <a ext:cls="apf.Container" href="output/apf.Container.html">apf.Container</a> and
to be automatically registered with the <a ext:cls="apf.ComponentMgr" href="output/apf.ComponentMgr.html">apf.ComponentMgr</a> so that it can be referenced at any time via
<a ext:cls="apf" ext:member="getCmp" href="output/apf.html#getCmp">apf.getCmp</a>. All visual widgets that require rendering into a layout should subclass Component (or
<a ext:cls="apf.BoxComponent" href="output/apf.BoxComponent.html">apf.BoxComponent</a> if managed box model handling is required).</p>
<p>Every component has a specific xtype, which is its apf-specific type name, along with methods for checking the
xtype like <a ext:cls="apf.Component" ext:member="getXType" href="output/apf.Component.html#getXType">getXType</a> and <a ext:cls="apf.Component" ext:member="isXType" href="output/apf.Component.html#isXType">isXType</a>. This is the list of all valid xtypes:</p>
<pre>xtype Class
------------- ------------------
box apf.BoxComponent
button apf.Button
colorpalette apf.ColorPalette
component apf.Component
container apf.Container
cycle apf.CycleButton
dataview apf.DataView
datepicker apf.DatePicker
editor apf.Editor
editorgrid apf.grid.EditorGridPanel
grid apf.grid.GridPanel
paging apf.PagingToolbar
panel apf.Panel
progress apf.ProgressBar
propertygrid apf.grid.PropertyGrid
slider apf.Slider
splitbutton apf.SplitButton
statusbar apf.StatusBar
tabpanel apf.TabPanel
treepanel apf.tree.TreePanel
viewport apf.Viewport
window apf.Window
Toolbar components
---------------------------------------
toolbar apf.Toolbar
tbbutton apf.Toolbar.Button
tbfill apf.Toolbar.Fill
tbitem apf.Toolbar.Item
tbseparator apf.Toolbar.Separator
tbspacer apf.Toolbar.Spacer
tbsplit apf.Toolbar.SplitButton
tbtext apf.Toolbar.TextItem
Form components
---------------------------------------
form apf.FormPanel
checkbox apf.form.Checkbox
combo apf.form.ComboBox
datefield apf.form.DateField
field apf.form.Field
fieldset apf.form.FieldSet
hidden apf.form.Hidden
htmleditor apf.form.HtmlEditor
label apf.form.Label
numberfield apf.form.NumberField
radio apf.form.Radio
textarea apf.form.TextArea
textfield apf.form.TextField
timefield apf.form.TimeField
trigger apf.form.TriggerField</pre>
The configuration options. If an element is passed, it is set as the internal
element and its id used as the component id. If a string is passed, it is assumed to be the id of an existing element
and is used as the component id. Otherwise, it is assumed to be a standard config object and is applied to the component.
This Component's initial configuration specification. Read-only.
The component's owner <a ext:cls="apf.Container" href="output/apf.Container.html">apf.Container</a> (defaults to undefined, and is set automatically when
the component is added to a container). Read-only.
True if this component is hidden. Read-only.
True if this component is disabled. Read-only.
True if this component has been rendered. Read-only.
<p>Render this Components into the passed HTML element.</p>
<p><b>If you are using a <a ext:cls="apf.Container" href="output/apf.Container.html">Container</a> object to house this Component, then
do not use the render method.</b></p>
<p>A Container's child Components are rendered by that Container's
<a ext:cls="apf.Container" ext:member="layout" href="output/apf.Container.html#layout">layout</a> manager when the Container is first rendered.</p>
<p>Certain layout managers allow dynamic addition of child components. Those that do
include <a ext:cls="apf.layout.CardLayout" href="output/apf.layout.CardLayout.html">apf.layout.CardLayout</a>, <a ext:cls="apf.layout.AnchorLayout" href="output/apf.layout.AnchorLayout.html">apf.layout.AnchorLayout</a>,
<a ext:cls="apf.layout.FormLayout" href="output/apf.layout.FormLayout.html">apf.layout.FormLayout</a>, <a ext:cls="apf.layout.TableLayout" href="output/apf.layout.TableLayout.html">apf.layout.TableLayout</a>.</p>
<p>If the Container is already rendered when a new child Component is added, you may need to call
the Container's <a ext:cls="apf.Container" ext:member="doLayout" href="output/apf.Container.html#doLayout">doLayout</a> to refresh the view which causes any
unrendered child Components to be rendered. This is required so that you can add multiple
child components if needed while only refreshing the layout once.</p>
<p>When creating complex UIs, it is important to remember that sizing and positioning
of child items is the responsibility of the Container's <a ext:cls="apf.Container" ext:member="layout" href="output/apf.Container.html#layout">layout</a> manager.
If you expect child items to be sized in response to user interactions, you must
configure the Container with a layout manager which creates and manages the type of layout you
have in mind.</p>
<p><b>Omitting the Container's <a ext:cls="apf.Container" ext:member="layout" href="output/apf.Container.html#layout">layout</a> config means that a basic
layout manager is used which does nothnig but render child components sequentially into the
Container. No sizing or positioning will be performed in this situation.</b></p>
(optional) The element this Component should be
rendered into. If it is being created from existing markup, this should be omitted.
(optional) The element ID or DOM node index within the container <b>before</b>
which this component will be inserted (defaults to appending to the end of the container)
Apply this component to existing markup that is valid. With this function, no call to render() is required.
Adds a CSS class to the component's underlying element.
The CSS class name to add
Removes a CSS class from the component's underlying element.
The CSS class name to remove
Destroys this component by purging any event listeners, removing the component's element from the DOM,
removing the component from its <a ext:cls="apf.Container" href="output/apf.Container.html">apf.Container</a> (if applicable) and unregistering it from
<a ext:cls="apf.ComponentMgr" href="output/apf.ComponentMgr.html">apf.ComponentMgr</a>. Destruction is generally handled automatically by the framework and this method
should usually not need to be called directly.
Returns the underlying <a ext:cls="apf.Element" href="output/apf.Element.html">apf.Element</a>.
Returns the id of this component.
Returns the item id of this component.
Try to focus this component.
(optional) If applicable, true to also select the text in this component
(optional) Delay the focus this number of milliseconds (true for 10 milliseconds)
Disable this component.
Enable this component.
Convenience function for setting disabled/enabled by boolean.
Show this component.
Hide this component.
Convenience function to hide or show this component by boolean.
True to show, false to hide
Returns true if this component is visible.
Clone the current component using the original config values passed into this instance by default.
A new config containing any properties to override in the cloned version.
An id property can be passed on this object, otherwise one will be generated to avoid duplicates.
Gets the xtype for this component as registered with <a ext:cls="apf.ComponentMgr" href="output/apf.ComponentMgr.html">apf.ComponentMgr</a>. For a list of all
available xtypes, see the <a ext:cls="apf.Component" href="output/apf.Component.html">apf.Component</a> header. Example usage:
<pre><code>var t = new apf.form.TextField();
alert(t.getXType()); // alerts 'textfield'</code></pre>
<p>Tests whether or not this Component is of a specific xtype. This can test whether this Component is descended
from the xtype (default) or whether it is directly of the xtype specified (shallow = true).</p>
<p><b>If using your own subclasses, be aware that a Component must register its own xtype
to participate in determination of inherited xtypes.</b></p>
<p>For a list of all available xtypes, see the <a ext:cls="apf.Component" href="output/apf.Component.html">apf.Component</a> header.</p>
<p>Example usage:</p>
<pre><code>var t = new apf.form.TextField();
var isText = t.isXType('textfield'); // true
var isBoxSubclass = t.isXType('box'); // true, descended from BoxComponent
var isBoxInstance = t.isXType('box', true); // false, not a direct BoxComponent instance</code></pre>
The xtype to check for this Component
(optional) False to check whether this Component is descended from the xtype (this is
the default), or true to check whether this Component is directly of the specified xtype.
<p>Returns this Component's xtype hierarchy as a slash-delimited string. For a list of all
available xtypes, see the <a ext:cls="apf.Component" href="output/apf.Component.html">apf.Component</a> header.</p>
<p><b>If using your own subclasses, be aware that a Component must register its own xtype
to participate in determination of inherited xtypes.</b></p>
<p>Example usage:</p>
<pre><code>
var t = new apf.form.TextField();
alert(t.getXTypes()); // alerts 'component/box/field/textfield'</pre></code>
Find a container above this component at any level by a custom function. If the passed function returns
true, the container will be returned. The passed function is called with the arguments (container, this component).
(optional)
Find a container above this component at any level by xtype or class
The xtype string for a component, or the class of the component directly
<p>Provides a registry of all Components (specifically subclasses of
<a ext:cls="apf.Component" href="output/apf.Component.html">apf.Component</a>) on a page so that they can be easily accessed by
component id (see <a ext:cls="apf.getCmp" href="output/apf.getCmp.html">apf.getCmp</a>).</p>
<p>This object also provides a registry of available Component <i>classes</i>
indexed by a mnemonic code known as the Component's <a ext:cls="apf.Component" ext:member="xtype" href="output/apf.Component.html#xtype">apf.Component.xtype</a>.
The <tt>xtype</tt> provides a way to avoid instantiating child Components
when creating a full, nested config object for a complete apf page.</p>
<p>
A child Component may be specified simply as a <i>config object</i>
as long as the correct xtype is specified so that if and when the Component
needs rendering, the correct type can be looked up for lazy instantiation.</p>
<p>For a list of all available xtypes, see <a ext:cls="apf.Component" href="output/apf.Component.html">apf.Component</a>.</p><br><br><i>This class is a singleton and cannot be created directly.</i>
The MixedCollection used internally for the component cache. An example usage may be subscribing to
events on the MixedCollection to monitor addition or removal. Read-only.
Registers a component.
The component
Unregisters a component.
The component
Returns a component by id
The component id
Registers a function that will be called when a specified component is added to ComponentMgr
The component id
The callback function
The scope of the callback
<p>Registers a new Component constructor, keyed by a new
<a ext:cls="apf.Component" ext:member="xtype" href="output/apf.Component.html#xtype">apf.Component.xtype</a>.</p>
<p>Use this method to register new subclasses of <a ext:cls="apf.Component" href="output/apf.Component.html">apf.Component</a> so
that lazy instantiation may be used when specifying child Components.
see <a ext:cls="apf.Container" ext:member="items" href="output/apf.Container.html#items">apf.Container.items</a></p>
The mnemonic string by which the Component class
may be looked up.
The new Component class.
Creates a new Component from the specified config object using the
config object's <a ext:cls="apf.component" ext:member="xtype" href="output/apf.component.html#xtype">xtype</a> to determine the class to instantiate.
A configuration object for the Component you wish to create.
The constructor to provide the default Component type if
the config object does not contain an xtype. (Optional if the config contains an xtype).
Standard composite class. Creates a apf.Element for every element in the collection.
<br><br>
<b>NOTE: Although they are not listed, this class supports all of the set/update methods of apf.Element. All apf.Element
actions will be performed on all the elements in this collection.</b>
<br><br>
All methods return <i>this</i> and can be chained.
<pre><code>var els = apf.select("#some-el div.some-class", true);
// or select directly from an existing element
var el = apf.get('some-el');
el.select('div.some-class', true);
els.setWidth(100); // all elements become 100 width
els.hide(true); // all elements fade out and hide
// or
els.setWidth(100).hide(true);</code></pre>
Clears this composite and adds the elements returned by the passed selector.
A string CSS selector, an array of elements or an element
Filters this composite to only elements that match the passed selector.
A string CSS selector
Adds elements to this composite.
A string CSS selector, an array of elements or an element
Calls the passed function passing (el, this, index) for each element in this composite.
The function to call
(optional) The <i>this</i> object (defaults to the element)
Returns the Element object at the specified index
Returns the first Element
Returns the last Element
Returns the number of elements in this composite
Returns true if this composite contains the passed element
The id of an element, or an apf.Element, or an HtmlElement to find within the composite collection.
Find the index of the passed element within the composite collection.
The id of an element, or an apf.Element, or an HtmlElement to find within the composite collection.
Removes the specified element(s).
The id of an element, the Element itself, the index of the element in this composite
or an array of any of those.
(optional) True to also remove the element from the document
Replaces the specified element with the passed element.
The id of an element, the Element itself, the index of the element in this composite
to replace.
The id of an element or the Element itself.
(Optional) True to remove and replace the element in the document too.
Removes all elements.
Flyweight composite class. Reuses the same apf.Element for element operations.
<pre><code>var els = apf.select("#some-el div.some-class");
// or select directly from an existing element
var el = apf.get('some-el');
el.select('div.some-class');
els.setWidth(100); // all elements become 100 width
els.hide(true); // all elements fade out and hide
// or
els.setWidth(100).hide(true);</code></pre><br><br>
<b>NOTE: Although they are not listed, this class supports all of the set/update methods of apf.Element. All apf.Element
actions will be performed on all the elements in this collection.</b>
Returns a flyweight Element of the dom element object at the specified index
Calls the passed function passing (el, this, index) for each element in this composite. <b>The element
passed is the flyweight (shared) apf.Element instance, so if you require a
a reference to the dom node, use el.dom.</b>
The function to call
(optional) The <i>this</i> object (defaults to the element)
<p>Base class for any <a ext:cls="apf.BoxComponent" href="output/apf.BoxComponent.html">apf.BoxComponent</a> that can contain other components. This class is intended
to be extended and should generally not need to be created directly via the new keyword. <a ext:cls="apf.Panel" href="output/apf.Panel.html">apf.Panel</a>,
<a ext:cls="apf.Window" href="output/apf.Window.html">apf.Window</a> and <a ext:cls="apf.TabPanel" href="output/apf.TabPanel.html">apf.TabPanel</a> are the most commonly used Container classes.</p>
Containers handle the basic behavior of containing items, namely adding, inserting and removing them.
The specific layout logic required to visually render contained items is delegated to any one of the different
<a ext:cls="apf.Container" ext:member="layout" href="output/apf.Container.html#layout">layout</a> classes available.</p>
<p>When either specifying child <a ext:cls="apf.Container" ext:member="items" href="output/apf.Container.html#items">items</a> of a Container, or dynamically adding components to a Container,
remember to consider how you wish the Container to arrange those child elements, and whether those child elements
need to be sized using one of apf's built-in layout schemes.</p>
<p>By default, Containers use the <a ext:cls="apf.layout.ContainerLayout" href="output/apf.layout.ContainerLayout.html">ContainerLayout</a> scheme. This simply renders
child components, appending them one after the other inside the Container, and does not apply any sizing at all.
This is a common source of confusion when widgets like GridPanels or TreePanels are added to Containers for
which no layout has been specified. If a Container is left to use the ContainerLayout scheme, none of its child
components will be resized, or changed in any way when the Container is resized.</p>
<p>A very common example of this is where a developer will attempt to add a GridPanel to a TabPanel by wrapping
the GridPanel <i>inside</i> a wrapping Panel and add that wrapping Panel to the TabPanel. This misses the point that
apf's inheritance means that a GridPanel <b>is</b> a Component which can be added unadorned into a Container. If
that wrapping Panel has no layout configuration, then the GridPanel will not be sized as expected.<p>
<p>Below is an example of adding a newly created GridPanel to a TabPanel. A TabPanel uses <a ext:cls="apf.layout.CardLayout" href="output/apf.layout.CardLayout.html">apf.layout.CardLayout</a>
as its layout manager which means all its child items are sized to fit exactly into its client area. The following
code requires prior knowledge of how to create GridPanels. See <a ext:cls="apf.grid.GridPanel" href="output/apf.grid.GridPanel.html">apf.grid.GridPanel</a>, <a ext:cls="apf.data.Store" href="output/apf.data.Store.html">apf.data.Store</a>
and <a ext:cls="apf.data.JsonReader" href="output/apf.data.JsonReader.html">apf.data.JsonReader</a> as well as the grid examples in the apf installation's <tt>examples/grid</tt>
directory.</p><pre><code>// Create the GridPanel.
myGrid = new apf.grid.GridPanel({
store: myStore,
columns: myColumnModel,
title: 'Results',
});
myTabPanel.add(myGrid);
myTabPanel.setActiveItem(myGrid);</code></pre>
The collection of components in this container as a <a ext:cls="apf.util.MixedCollection" href="output/apf.util.MixedCollection.html">apf.util.MixedCollection</a>
<p>Adds a <a ext:cls="apf.Component" href="output/apf.Component.html">Component</a> to this Container. Fires the <a ext:cls="apf.Container" ext:member="beforeadd" href="output/apf.Container.html#beforeadd">beforeadd</a> event before
adding, then fires the <a ext:cls="apf.Container" ext:member="add" href="output/apf.Container.html#add">add</a> event after the component has been added.</p>
<p>You will never call the render method of a child Component when using a Container.
Child Components are rendered by this Container's <a ext:cls="apf.Container" ext:member="layout" href="output/apf.Container.html#layout">layout</a> manager when
this Container is first rendered.</p>
<p>Certain layout managers allow dynamic addition of child components. Those that do
include <a ext:cls="apf.layout.CardLayout" href="output/apf.layout.CardLayout.html">apf.layout.CardLayout</a>, <a ext:cls="apf.layout.AnchorLayout" href="output/apf.layout.AnchorLayout.html">apf.layout.AnchorLayout</a>,
<a ext:cls="apf.layout.FormLayout" href="output/apf.layout.FormLayout.html">apf.layout.FormLayout</a>, <a ext:cls="apf.layout.TableLayout" href="output/apf.layout.TableLayout.html">apf.layout.TableLayout</a>.</p>
<p>If the Container is already rendered when add is called, you may need to call
<a ext:cls="apf.Container" ext:member="doLayout" href="output/apf.Container.html#doLayout">doLayout</a> to refresh the view which causes any unrendered child Components
to be rendered. This is required so that you can add multiple child components if needed
while only refreshing the layout once.</p>
<p>When creating complex UIs, it is important to remember that sizing and positioning
of child items is the responsibility of the Container's <a ext:cls="apf.Container" ext:member="layout" href="output/apf.Container.html#layout">layout</a> manager. If
you expect child items to be sized in response to user interactions, you must
specify a layout manager which creates and manages the type of layout you have in mind.</p>
<p><b>Omitting the <a ext:cls="apf.Container" ext:member="layout" href="output/apf.Container.html#layout">layout</a> config means that a basic layout manager is
used which does nothnig but render child components sequentially into the Container.
No sizing or positioning will be performed in this situation.</b></p>
The Component to add.<br><br>
apf uses lazy rendering, and will only render the added Component should
it become necessary, that is: when the Container is layed out either on first render
or in response to a <a ext:cls="apf.Container" ext:member="doLayout" href="output/apf.Container.html#doLayout">doLayout</a> call.<br><br>
A Component config object may be passed instead of an instantiated Component object.
The type of Component created from a config object is determined by the <a ext:cls="apf.Component" ext:member="xtype" href="output/apf.Component.html#xtype">xtype</a>
config property. If no xtype is configured, the Container's <a ext:cls="apf.Container" ext:member="defaultType" href="output/apf.Container.html#defaultType">defaultType</a>
is used.<br><br>
For a list of all available xtypes, see <a ext:cls="apf.Component" href="output/apf.Component.html">apf.Component</a>.
Inserts a Component into this Container at a specified index. Fires the
<a ext:cls="apf.Container" ext:member="beforeadd" href="output/apf.Container.html#beforeadd">beforeadd</a> event before inserting, then fires the <a ext:cls="apf.Container" ext:member="add" href="output/apf.Container.html#add">add</a> event after the
Component has been inserted.
The index at which the Component will be inserted
into the Container's items collection
The child Component to insert.<br><br>
apf uses lazy rendering, and will only render the inserted Component should
it become necessary.<br><br>
A Component config object may be passed in order to avoid the overhead of
constructing a real Component object if lazy rendering might mean that the
inserted Component will not be rendered immediately. To take advantage of
this "lazy instantiation", set the <a ext:cls="apf.Component" ext:member="xtype" href="output/apf.Component.html#xtype">apf.Component.xtype</a> config
property to the registered type of the Component wanted.<br><br>
For a list of all available xtypes, see <a ext:cls="apf.Component" href="output/apf.Component.html">apf.Component</a>.
Removes a component from this container. Fires the <a ext:cls="apf.Container" ext:member="beforeremove" href="output/apf.Container.html#beforeremove">beforeremove</a> event before removing, then fires
the <a ext:cls="apf.Container" ext:member="remove" href="output/apf.Container.html#remove">remove</a> event after the component has been removed.
The component reference or id to remove.
(optional) True to automatically invoke the removed Component's <a ext:cls="apf.Component" ext:member="destroy" href="output/apf.Component.html#destroy">apf.Component.destroy</a> function.
Defaults to the value of this Container's <a ext:cls="apf.Container" ext:member="autoDestroy" href="output/apf.Container.html#autoDestroy">autoDestroy</a> config.
Gets a direct child Component by id, or by index.
or index of child Component to return.
Force this container's layout to be recalculated. A call to this function is required after adding a new component
to an already rendered container, or possibly after changing sizing/position properties of child components.
(optional) True to only calc the layout of this component, and let child components auto
calc layouts as required (defaults to false, which calls doLayout recursively for each subcontainer)
Returns the layout currently in use by the container. If the container does not currently have a layout
set, a default <a ext:cls="apf.layout.ContainerLayout" href="output/apf.layout.ContainerLayout.html">apf.layout.ContainerLayout</a> will be created and set as the container's layout.
Bubbles up the component/container heirarchy, calling the specified function with each component. The scope (<i>this</i>) of
function call will be the scope provided or the current component. The arguments to the function
will be the args provided or the current component. If the function returns false at any point,
the bubble is stopped.
The function to call
(optional) The scope of the function (defaults to current node)
(optional) The args to call the function with (default to passing the current component)
Cascades down the component/container heirarchy from this component (called first), calling the specified function with
each component. The scope (<i>this</i>) of
function call will be the scope provided or the current component. The arguments to the function
will be the args provided or the current component. If the function returns false at any point,
the cascade is stopped on that branch.
The function to call
(optional) The scope of the function (defaults to current component)
(optional) The args to call the function with (defaults to passing the current component)
Find a component under this container at any level by id
Find a component under this container at any level by xtype or class
The xtype string for a component, or the class of the component directly
Find a component under this container at any level by property
Find a component under this container at any level by a custom function. If the passed function returns
true, the component will be included in the results. The passed function is called with the arguments (component, this container).
(optional)
A specialized SplitButton that contains a menu of <a ext:cls="apf.menu.CheckItem" href="output/apf.menu.CheckItem.html">apf.menu.CheckItem</a> elements. The button automatically
cycles through each menu item on click, raising the button's <a ext:cls="apf.CycleButton" ext:member="change" href="output/apf.CycleButton.html#change">change</a> event (or calling the button's
<a ext:cls="apf.CycleButton" ext:member="changeHandler" href="output/apf.CycleButton.html#changeHandler">changeHandler</a> function, if supplied) for the active menu item. Clicking on the arrow section of the
button displays the dropdown menu just like a normal SplitButton. Example usage:
<pre><code>var btn = new apf.CycleButton({
showText: true,
prependText: 'View as ',
items: [{
text:'text only',
iconCls:'view-text',
checked:true
},{
text:'HTML',
iconCls:'view-html'
}],
changeHandler:function(btn, item){
apf.Msg.alert('Change View', item.text);
}
});</code></pre>
Create a new split button
The config object
Sets the button's active menu item.
The item to activate
True to prevent the button's change event from firing (defaults to false)
Gets the currently active menu item.
This is normally called internally on button click, but can be called externally to advance the button's
active item programmatically to the next one in the menu. If the current item is the last one in the menu
the active item will be set to the first item in the menu.
A mechanism for displaying data using custom layout templates and formatting. DataView uses an <a ext:cls="apf.XTemplate" href="output/apf.XTemplate.html">apf.XTemplate</a>
as its internal templating mechanism, and is bound to an <a ext:cls="apf.data.Store" href="output/apf.data.Store.html">apf.data.Store</a>
so that as the data in the store changes the view is automatically updated to reflect the changes. The view also
provides built-in behavior for many common events that can occur for its contained items including click, doubleclick,
mouseover, mouseout, etc. as well as a built-in selection model. <b>In order to use these features, an <a ext:cls="apf.DataView" ext:member="itemSelector" href="output/apf.DataView.html#itemSelector">itemSelector</a>
config must be provided for the DataView to determine what nodes it will be working with.</b>
<p>The example below binds a DataView to a <a ext:cls="apf.data.Store" href="output/apf.data.Store.html">apf.data.Store</a> and renders it into an <a ext:cls="apf.Panel" href="output/apf.Panel.html">apf.Panel</a>.</p>
<pre><code>var store = new apf.data.JsonStore({
url: 'get-images.php',
root: 'images',
fields: [
'name', 'url',
{name:'size', type: 'float'},
{name:'lastmod', type:'date', dateFormat:'timestamp'}
]
});
store.load();
var tpl = new apf.XTemplate(
'<tpl for=".">',
'<div class="thumb-wrap" id="{name}">',
'<div class="thumb"><img src="{url}" title="{name}"></div>',
'<span class="x-editable">{shortName}</span></div>',
'</tpl>',
'<div class="x-clear"></div>'
);
var panel = new apf.Panel({
id:'images-view',
frame:true,
width:535,
autoHeight:true,
collapsible:true,
layout:'fit',
title:'Simple DataView',
items: new apf.DataView({
store: store,
tpl: tpl,
autoHeight:true,
multiSelect: true,
overClass:'x-view-over',
itemSelector:'div.thumb-wrap',
emptyText: 'No images to display'
})
});
panel.render(document.body);</code></pre>
Create a new DataView
The config object
Refreshes the view by reloading the data from the store and re-rendering the template.
Function which can be overridden to provide custom formatting for each Record that is used by this
DataView's <a ext:cls="apf.DataView" ext:member="tpl" href="output/apf.DataView.html#tpl">template</a> to render each node.
The raw data object that was used to create the Record.
the index number of the Record being prepared for rendering.
The Record being prepared for rendering.
<p>Function which can be overridden which returns the data object passed to this
DataView's <a ext:cls="apf.DataView" ext:member="tpl" href="output/apf.DataView.html#tpl">template</a> to render the whole DataView.</p>
<p>This is usually an Array of data objects, each element of which is processed by an
<a ext:cls="apf.XTemplate" href="output/apf.XTemplate.html">XTemplate</a> which uses <tt>'<tpl for=".">'</tt> to iterate over its supplied
data object as an Array. However, <i>named</i> properties may be placed into the data object to
provide non-repeating data such as headings, totals etc.</p>
An Array of <a ext:cls="apf.data.Record" href="output/apf.data.Record.html">apf.data.Record</a>s to be rendered into the DataView.
Refreshes an individual node's data from the store.
The item's data index in the store
Changes the data store bound to this view and refreshes it.
The store to bind to this view
Returns the template node the passed child belongs to, or null if it doesn't belong to one.
Gets the number of selected nodes.
Gets the currently selected nodes.
Gets the indexes of the selected nodes.
Gets an array of the selected records
Gets an array of the records from an array of nodes
The nodes to evaluate
Gets a record from a node
The node to evaluate
Clears all selections.
(optional) True to skip firing of the selectionchange event
Returns true if the passed node is selected, else false.
The node or node index to check
Deselects a node.
The node to deselect
Selects a set of nodes.
An HTMLElement template node, index of a template node,
id of a template node or an array of any of those to select
(optional) true to keep existing selections
(optional) true to skip firing of the selectionchange vent
Selects a range of nodes. All nodes between start and end are selected.
The index of the first node in the range
The index of the last node in the range
(optional) True to retain existing selections
Gets a template node.
An HTMLElement template node, index of a template node or the id of a template node
Gets a range nodes.
(optional) The index of the first node in the range
(optional) The index of the last node in the range
Finds the index of the passed node.
An HTMLElement template node, index of a template node or the id of a template node
Simple date picker class.
Create a new DatePicker
The config object
Replaces any existing disabled dates with new values and refreshes the DatePicker.
An array of date strings (see the <a ext:cls="apf.DatePicker" ext:member="disabledDates" href="output/apf.DatePicker.html#disabledDates">disabledDates</a> config
for details on supported values), or a JavaScript regular expression used to disable a pattern of dates.
Replaces any existing disabled days (by index, 0-6) with new values and refreshes the DatePicker.
An array of disabled day indexes. See the <a ext:cls="apf.DatePicker" ext:member="disabledDays" href="output/apf.DatePicker.html#disabledDays">disabledDays</a> config
for details on supported values.
Replaces any existing <a ext:cls="apf.DatePicker" ext:member="minDate" href="output/apf.DatePicker.html#minDate">minDate</a> with the new value and refreshes the DatePicker.
The minimum date that can be selected
Replaces any existing <a ext:cls="apf.DatePicker" ext:member="maxDate" href="output/apf.DatePicker.html#maxDate">maxDate</a> with the new value and refreshes the DatePicker.
The maximum date that can be selected
Sets the value of the date field
The date to set
Gets the current selected value of the date field
Utility class for working with DOM and/or Templates. It transparently supports using HTML fragments or DOM.<br>
This is an example, where an unordered list with 5 children items is appended to an existing element with id 'my-div':<br>
<pre><code>var dh = apf.DomHelper;
var list = dh.append('my-div', {
id: 'my-ul', tag: 'ul', cls: 'my-list', children: [
{tag: 'li', id: 'item0', html: 'List Item 0'},
{tag: 'li', id: 'item1', html: 'List Item 1'},
{tag: 'li', id: 'item2', html: 'List Item 2'},
{tag: 'li', id: 'item3', html: 'List Item 3'},
{tag: 'li', id: 'item4', html: 'List Item 4'}
]
});</code></pre>
<p>Element creation specification parameters in this class may also be passed as an Array of
specification objects. This can be used to insert multiple sibling nodes into an existing
container very efficiently. For example, to add more list items to the example above:<pre><code>dh.append('my-ul', [
{tag: 'li', id: 'item5', html: 'List Item 5'},
{tag: 'li', id: 'item6', html: 'List Item 6'} ]);</code></pre></p>
<p>Element creation specification parameters may also be strings. If <a ext:cls="useDom" href="output/useDom.html">useDom</a> is false, then the string is used
as innerHTML. If <a ext:cls="useDom" href="output/useDom.html">useDom</a> is true, a string specification results in the creation of a text node.</p>
For more information and examples, see <a href="http://www.jackslocum.com/blog/2006/10/06/domhelper-create-elements-using-dom-html-fragments-or-templates/">the original blog post</a>.<br><br><i>This class is a singleton and cannot be created directly.</i>
True to force the use of DOM instead of html fragments
Returns the markup for the passed Element(s) config.
The DOM object spec (and children)
Applies a style specification to an element.
The element to apply styles to
A style specification string eg "width:100px", or object in the form {width:"100px"}, or
a function which returns such a specification.
Inserts an HTML fragment into the DOM.
Where to insert the html in relation to el - beforeBegin, afterBegin, beforeEnd, afterEnd.
The context element
The HTML fragmenet
Creates new DOM element(s) and inserts them before el.
The context element
The DOM object spec (and children) or raw HTML blob
(optional) true to return a apf.Element
Creates new DOM element(s) and inserts them after el.
The context element
The DOM object spec (and children)
(optional) true to return a apf.Element
Creates new DOM element(s) and inserts them as the first child of el.
The context element
The DOM object spec (and children) or raw HTML blob
(optional) true to return a apf.Element
Creates new DOM element(s) and appends them to el.
The context element
The DOM object spec (and children) or raw HTML blob
(optional) true to return a apf.Element
Creates new DOM element(s) and overwrites the contents of el with them.
The context element
The DOM object spec (and children) or raw HTML blob
(optional) true to return a apf.Element
Creates a new apf.Template from the DOM object spec.
The DOM object spec (and children)
*
Provides high performance selector/xpath processing by compiling queries into reusable functions. New pseudo classes and matchers can be plugged. It works on HTML and XML documents (if a content node is passed in).
<p>
DomQuery supports most of the <a href="http://www.w3.org/TR/2005/WD-css3-selectors-20051215/#selectors">CSS3 selectors spec</a>, along with some custom selectors and basic XPath.</p>
<p>
All selectors, attribute filters and pseudos below can be combined infinitely in any order. For example "div.foo:nth-child(odd)[@foo=bar].bar:first" would be a perfectly valid selector. Node filters are processed in the order in which they appear, which allows you to optimize your queries for your document structure.
</p>
<h4>Element Selectors:</h4>
<ul class="list">
<li> <b>*</b> any element</li>
<li> <b>E</b> an element with the tag E</li>
<li> <b>E F</b> All descendent elements of E that have the tag F</li>
<li> <b>E > F</b> or <b>E/F</b> all direct children elements of E that have the tag F</li>
<li> <b>E + F</b> all elements with the tag F that are immediately preceded by an element with the tag E</li>
<li> <b>E ~ F</b> all elements with the tag F that are preceded by a sibling element with the tag E</li>
</ul>
<h4>Attribute Selectors:</h4>
<p>The use of @ and quotes are optional. For example, div[@foo='bar'] is also a valid attribute selector.</p>
<ul class="list">
<li> <b>E[foo]</b> has an attribute "foo"</li>
<li> <b>E[foo=bar]</b> has an attribute "foo" that equals "bar"</li>
<li> <b>E[foo^=bar]</b> has an attribute "foo" that starts with "bar"</li>
<li> <b>E[foo$=bar]</b> has an attribute "foo" that ends with "bar"</li>
<li> <b>E[foo*=bar]</b> has an attribute "foo" that contains the substring "bar"</li>
<li> <b>E[foo%=2]</b> has an attribute "foo" that is evenly divisible by 2</li>
<li> <b>E[foo!=bar]</b> has an attribute "foo" that does not equal "bar"</li>
</ul>
<h4>Pseudo Classes:</h4>
<ul class="list">
<li> <b>E:first-child</b> E is the first child of its parent</li>
<li> <b>E:last-child</b> E is the last child of its parent</li>
<li> <b>E:nth-child(<i>n</i>)</b> E is the <i>n</i>th child of its parent (1 based as per the spec)</li>
<li> <b>E:nth-child(odd)</b> E is an odd child of its parent</li>
<li> <b>E:nth-child(even)</b> E is an even child of its parent</li>
<li> <b>E:only-child</b> E is the only child of its parent</li>
<li> <b>E:checked</b> E is an element that is has a checked attribute that is true (e.g. a radio or checkbox) </li>
<li> <b>E:first</b> the first E in the resultset</li>
<li> <b>E:last</b> the last E in the resultset</li>
<li> <b>E:nth(<i>n</i>)</b> the <i>n</i>th E in the resultset (1 based)</li>
<li> <b>E:odd</b> shortcut for :nth-child(odd)</li>
<li> <b>E:even</b> shortcut for :nth-child(even)</li>
<li> <b>E:contains(foo)</b> E's innerHTML contains the substring "foo"</li>
<li> <b>E:nodeValue(foo)</b> E contains a textNode with a nodeValue that equals "foo"</li>
<li> <b>E:not(S)</b> an E element that does not match simple selector S</li>
<li> <b>E:has(S)</b> an E element that has a descendent that matches simple selector S</li>
<li> <b>E:next(S)</b> an E element whose next sibling matches simple selector S</li>
<li> <b>E:prev(S)</b> an E element whose previous sibling matches simple selector S</li>
</ul>
<h4>CSS Value Selectors:</h4>
<ul class="list">
<li> <b>E{display=none}</b> css value "display" that equals "none"</li>
<li> <b>E{display^=none}</b> css value "display" that starts with "none"</li>
<li> <b>E{display$=none}</b> css value "display" that ends with "none"</li>
<li> <b>E{display*=none}</b> css value "display" that contains the substring "none"</li>
<li> <b>E{display%=2}</b> css value "display" that is evenly divisible by 2</li>
<li> <b>E{display!=none}</b> css value "display" that does not equal "none"</li>
</ul><br><br><i>This class is a singleton and cannot be created directly.</i>
Collection of matching regular expressions and code snippets.
Collection of operator comparison functions. The default operators are =, !=, ^=, $=, *=, %=, |= and ~=.
New operators can be added as long as the match the format <i>c</i>= where <i>c</i> is any character other than space, > <.
Collection of "pseudo class" processors. Each processor is passed the current nodeset (array)
and the argument (if any) supplied in the selector.
Compiles a selector/xpath query into a reusable function. The returned function
takes one parameter "root" (optional), which is the context node from where the query should start.
The selector/xpath query
(optional) Either "select" (the default) or "simple" for a simple selector match
Selects a group of elements.
The selector/xpath query (can be a comma separated list of selectors)
(optional) The start of the query (defaults to document).
Selects a single element.
The selector/xpath query
(optional) The start of the query (defaults to document).
Selects the value of a node, optionally replacing null with the defaultValue.
The selector/xpath query
(optional) The start of the query (defaults to document).
Selects the value of a node, parsing integers and floats. Returns the defaultValue, or 0 if none is specified.
The selector/xpath query
(optional) The start of the query (defaults to document).
Returns true if the passed element(s) match the passed simple selector (e.g. div.some-class or span:first-child)
An element id, element or array of elements
The simple selector to test
Filters an array of elements to only include matches of a simple selector (e.g. div.some-class or span:first-child)
An array of elements to filter
The simple selector to test
If true, it returns the elements that DON'T match
the selector instead of the ones that match
A base editor field that handles displaying/hiding on demand and has some built-in sizing and event handling logic.
Create a new Editor
The Field object (or descendant)
The config object
Starts the editing process and shows the editor.
The element to edit
(optional) A value to initialize the editor with. If a value is not provided, it defaults
to the innerHTML of el.
Sets the height and width of this editor.
The new width
The new height
Realigns the editor to the bound field based on the current alignment config value.
Ends the editing process, persists the changed value to the underlying field, and hides the editor.
Override the default behavior and keep the editor visible after edit (defaults to false)
Cancels the editing process and hides the editor without persisting any changes. The field value will be
reverted to the original starting value.
Override the default behavior and keep the editor visible after
cancel (defaults to false)
Sets the data value of the editor
Any valid value supported by the underlying field
Gets the data value of the editor
Represents an Element in the DOM.<br><br>
Usage:<br>
<pre><code>// by id
var el = apf.get("my-div");
// by DOM element reference
var el = apf.get(myDivElement);</code></pre>
<b>Animations</b><br />
Many of the functions for manipulating an element have an optional "animate" parameter. The animate parameter
should either be a boolean (true) or an object literal with animation options. Note that the supported Element animation
options are a subset of the <a ext:cls="apf.Fx" href="output/apf.Fx.html">apf.Fx</a> animation options specific to Fx effects. The Element animation options are:
<pre>Option Default Description
--------- -------- ---------------------------------------------
duration .35 The duration of the animation in seconds
easing easeOut The easing method
callback none A function to execute when the anim completes
scope this The scope (this) of the callback function</pre>
Also, the Anim object being used for the animation will be set on your options object as "anim", which allows you to stop or
manipulate the animation. Here's an example:
<pre><code>var el = apf.get("my-div");
// no animation
el.setWidth(100);
// default animation
el.setWidth(100, true);
// animation with some options set
el.setWidth(100, {
duration: 1,
callback: this.foo,
scope: this
});
// using the "anim" property to get the Anim object
var opt = {
duration: 1,
callback: this.foo,
scope: this
};
el.setWidth(100, opt);
...
if(opt.anim.isAnimated()){
opt.anim.stop();
}</code></pre>
<b> Composite (Collections of) Elements</b><br />
For working with collections of Elements, see <a ext:cls="apf.CompositeElement" href="output/apf.CompositeElement.html">apf.CompositeElement</a>
Create a new Element directly.
(optional) By default the constructor checks to see if there is already an instance of this element in the cache and if there is it returns the same instance. This will skip that check (useful for extending this class).
The DOM element
The DOM element ID
The element's default display mode (defaults to "")
The default unit to append to CSS values where a unit isn't provided (defaults to px).
<static> Visibility mode constant - Use visibility to hide element
<static> Visibility mode constant - Use display to hide element
Sets the element's visibility mode. When setVisible() is called it
will use this to determine whether to set the visibility or the display property.
or Element.DISPLAY
Convenience method for setVisibilityMode(Element.DISPLAY)
(optional) What to set display to when visible
Looks at this node and then at parent nodes for a match of the passed simple selector (e.g. div.some-class or span:first-child)
The simple selector to test
(optional) The max depth to
search as a number or element (defaults to 10 || document.body)
(optional) True to return a apf.Element object instead of DOM node
Looks at parent nodes for a match of the passed simple selector (e.g. div.some-class or span:first-child)
The simple selector to test
(optional) The max depth to
search as a number or element (defaults to 10 || document.body)
(optional) True to return a apf.Element object instead of DOM node
Walks up the dom looking for a parent node that matches the passed simple selector (e.g. div.some-class or span:first-child).
This is a shortcut for findParentNode() that always returns an apf.Element.
The simple selector to test
(optional) The max depth to
search as a number or element (defaults to 10 || document.body)
Returns true if this element matches the passed simple selector (e.g. div.some-class or span:first-child)
The simple selector to test
Perform animation on this element.
The animation control args
(optional) How long the animation lasts in seconds (defaults to .35)
(optional) Function to call when animation completes
(optional) Easing method to use (defaults to 'easeOut')
(optional) 'run' is the default. Can also be 'color', 'motion', or 'scroll'
Removes worthless text nodes
(optional) By default the element
keeps track if it has been cleaned already so
you can call this over and over. However, if you update the element and
need to force a reclean, you can pass true.
Scrolls this element into view within the passed container.
(optional) The container element to scroll (defaults to document.body). Should be a
string (id), dom node, or apf.Element.
(optional) False to disable horizontal scroll (defaults to true)
Measures the element's content height and updates height to match. Note: this function uses setTimeout so
the new height may not be available immediately.
(optional) Animate the transition (defaults to false)
(optional) Length of the animation in seconds (defaults to .35)
(optional) Function to call when animation completes
(optional) Easing method to use (defaults to easeOut)
Returns true if this element is an ancestor of the passed element
The element to check
Checks whether the element is currently visible using both visibility and display properties.
(optional) True to walk the dom and see if parent elements are hidden (defaults to false)
Creates a <a ext:cls="apf.CompositeElement" href="output/apf.CompositeElement.html">apf.CompositeElement</a> for child nodes based on the passed CSS selector (the selector should not contain an id).
The CSS selector
(optional) True to create a unique apf.Element for each child (defaults to false, which creates a single shared flyweight object)
Selects child nodes based on the passed CSS selector (the selector should not contain an id).
The CSS selector
Selects a single child at any depth below this element based on the passed CSS selector (the selector should not contain an id).
The CSS selector
(optional) True to return the DOM node instead of apf.Element (defaults to false)
Selects a single *direct* child based on the passed CSS selector (the selector should not contain an id).
The CSS selector
(optional) True to return the DOM node instead of apf.Element (defaults to false)
Initializes a <a ext:cls="apf.dd.DD" href="output/apf.dd.DD.html">apf.dd.DD</a> drag drop object for this element.
The group the DD object is member of
The DD config object
An object containing methods to override/implement on the DD object
Initializes a <a ext:cls="apf.dd.DDProxy" href="output/apf.dd.DDProxy.html">apf.dd.DDProxy</a> object for this element.
The group the DDProxy object is member of
The DDProxy config object
An object containing methods to override/implement on the DDProxy object
Initializes a <a ext:cls="apf.dd.DDTarget" href="output/apf.dd.DDTarget.html">apf.dd.DDTarget</a> object for this element.
The group the DDTarget object is member of
The DDTarget config object
An object containing methods to override/implement on the DDTarget object
Sets the visibility of the element (see details). If the visibilityMode is set to Element.DISPLAY, it will use
the display property to hide the element, otherwise it uses visibility. The default is to hide and show using the visibility property.
Whether the element is visible
(optional) True for the default animation, or a standard Element animation config object
Returns true if display is not "none"
Toggles the element's visibility or display, depending on visibility mode.
(optional) True for the default animation, or a standard Element animation config object
Sets the CSS display property. Uses originalDisplay if the specified value is a boolean true.
Boolean value to display the element using its default display, or a string to set the display directly.
Tries to focus the element. Any exceptions are caught and ignored.
Tries to blur the element. Any exceptions are caught and ignored.
Adds one or more CSS classes to the element. Duplicate classes are automatically filtered out.
The CSS class to add, or an array of classes
Adds one or more CSS classes to this element and removes the same class(es) from all siblings.
The CSS class to add, or an array of classes
Removes one or more CSS classes from the element.
The CSS class to remove, or an array of classes
Toggles the specified CSS class on this element (removes it if it already exists, otherwise adds it).
The CSS class to toggle
Checks if the specified CSS class exists on this element's DOM node.
The CSS class to check for
Replaces a CSS class on the element with another. If the old name does not exist, the new name will simply be added.
The CSS class to replace
The replacement CSS class
Returns an object with properties matching the styles requested.
For example, el.getStyles('color', 'font-size', 'width') might return
{'color': '#FFFFFF', 'font-size': '13px', 'width': '100px'}.
A style name
A style name
Normalizes currentStyle and computedStyle.
The style property whose value is returned.
Wrapper for setting style properties, also takes single object parameter of multiple styles.
The style property to be set, or an object of multiple styles.
(optional) The value to apply to the given property, or null if an object was passed.
More flexible version of <a ext:cls="apf.Element" ext:member="setStyle" href="output/apf.Element.html#setStyle">setStyle</a> for setting style properties.
A style specification string, e.g. "width:100px", or object in the form {width:"100px"}, or
a function which returns such a specification.
Gets the current X position of the element based on page coordinates. Element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
Gets the current Y position of the element based on page coordinates. Element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
Gets the current position of the element based on page coordinates. Element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
Returns the offsets of this element from the passed element. Both element must be part of the DOM tree and not have display:none to have page coordinates.
The element to get the offsets from.
Sets the X position of the element based on page coordinates. Element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
X position of the element
(optional) True for the default animation, or a standard Element animation config object
Sets the Y position of the element based on page coordinates. Element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
Y position of the element
(optional) True for the default animation, or a standard Element animation config object
Sets the element's left position directly using CSS style (instead of <a ext:cls="apf.Element" ext:member="setX" href="output/apf.Element.html#setX">setX</a>).
The left CSS property value
Sets the element's top position directly using CSS style (instead of <a ext:cls="apf.Element" ext:member="setY" href="output/apf.Element.html#setY">setY</a>).
The top CSS property value
Sets the element's CSS right style.
The right CSS property value
Sets the element's CSS bottom style.
The bottom CSS property value
Sets the position of the element in page coordinates, regardless of how the element is positioned.
The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
Contains X & Y [x, y] values for new position (coordinates are page-based)
(optional) True for the default animation, or a standard Element animation config object
Sets the position of the element in page coordinates, regardless of how the element is positioned.
The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
X value for new position (coordinates are page-based)
Y value for new position (coordinates are page-based)
(optional) True for the default animation, or a standard Element animation config object
Sets the position of the element in page coordinates, regardless of how the element is positioned.
The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
X value for new position (coordinates are page-based)
Y value for new position (coordinates are page-based)
(optional) True for the default animation, or a standard Element animation config object
Returns the region of the given element.
The element must be part of the DOM tree to have a region (display:none or elements not appended return false).
Returns the offset height of the element
(optional) true to get the height minus borders and padding
Returns the offset width of the element
(optional) true to get the width minus borders and padding
Returns either the offsetHeight or the height of this element based on CSS height adjusted by padding or borders
when needed to simulate offsetHeight when offsets aren't available. This may not work on display:none elements
if a height has not been set using CSS.
Returns either the offsetWidth or the width of this element based on CSS width adjusted by padding or borders
when needed to simulate offsetWidth when offsets aren't available. This may not work on display:none elements
if a width has not been set using CSS.
Returns the size of the element.
(optional) true to get the width/size minus borders and padding
Returns the width and height of the viewport.
Returns the value of the "value" attribute
true to parse the value as a number
Set the width of the element
The new width
(optional) true for the default animation or a standard Element animation config object
Set the height of the element
The new height
(optional) true for the default animation or a standard Element animation config object
Set the size of the element. If animation is true, both width an height will be animated concurrently.
The new width
The new height
(optional) true for the default animation or a standard Element animation config object
Sets the element's position and size in one shot. If animation is true then width, height, x and y will be animated concurrently.
X value for new position (coordinates are page-based)
Y value for new position (coordinates are page-based)
The new width
The new height
(optional) true for the default animation or a standard Element animation config object
Sets the element's position and size the specified region. If animation is true then width, height, x and y will be animated concurrently.
The region to fill
(optional) true for the default animation or a standard Element animation config object
Appends an event handler to this element. The shorthand version <a ext:cls="apf.Element" ext:member="on" href="output/apf.Element.html#on">on</a> is equivalent.
The type of event to handle
The handler function the event invokes. This function is passed
the following parameters:<ul>
<li>evt : EventObject<div class="sub-desc">The <a ext:cls="apf.EventObject" href="output/apf.EventObject.html">EventObject</a> describing the event.</div></li>
<li>t : Element<div class="sub-desc">The <a ext:cls="apf.Element" href="output/apf.Element.html">Element</a> which was the target of the event.
Note that this may be filtered by using the <tt>delegate</tt> option.</div></li>
<li>o : Object<div class="sub-desc">The options object from the addListener call.</div></li>
</ul>
(optional) The scope (The <tt>this</tt> reference) of the handler function. Defaults
to this Element.
(optional) An object containing handler configuration properties.
This may contain any of the following properties:<ul>
<li>scope {Object} : The scope in which to execute the handler function. The handler function's "this" context.</li>
<li>delegate {String} : A simple selector to filter the target or look for a descendant of the target</li>
<li>stopEvent {Boolean} : True to stop the event. That is stop propagation, and prevent the default action.</li>
<li>preventDefault {Boolean} : True to prevent the default action</li>
<li>stopPropagation {Boolean} : True to prevent event propagation</li>
<li>normalized {Boolean} : False to pass a browser event to the handler function instead of an apf.EventObject</li>
<li>delay {Number} : The number of milliseconds to delay the invocation of the handler after te event fires.</li>
<li>single {Boolean} : True to add a handler to handle just the next firing of the event, and then remove itself.</li>
<li>buffer {Number} : Causes the handler to be scheduled to run in an <a ext:cls="apf.util.DelayedTask" href="output/apf.util.DelayedTask.html">apf.util.DelayedTask</a> delayed
by the specified number of milliseconds. If the event fires again within that time, the original
handler is <em>not</em> invoked, but the new handler is scheduled in its place.</li>
</ul><br>
<p>
<b>Combining Options</b><br>
In the following examples, the shorthand form <a ext:cls="apf.Element" ext:member="on" href="output/apf.Element.html#on">on</a> is used rather than the more verbose
addListener. The two are equivalent. Using the options argument, it is possible to combine different
types of listeners:<br>
<br>
A normalized, delayed, one-time listener that auto stops the event and adds a custom argument (forumId) to the
options object. The options object is available as the third parameter in the handler function.<div style="margin: 5px 20px 20px;">
Code:<pre><code>el.on('click', this.onClick, this, {
single: true,
delay: 100,
stopEvent : true,
forumId: 4
});</code></pre></p>
<p>
<b>Attaching multiple handlers in 1 call</b><br>
The method also allows for a single argument to be passed which is a config object containing properties
which specify multiple handlers.</p>
<p>
Code:<pre><code></p>
el.on({
'click' : {
fn: this.onClick,
scope: this,
delay: 100
},
'mouseover' : {
fn: this.onMouseOver,
scope: this
},
'mouseout' : {
fn: this.onMouseOut,
scope: this
}
});</code></pre>
<p>
Or a shorthand syntax:<br>
Code:<pre><code></p>
el.on({
'click' : this.onClick,
'mouseover' : this.onMouseOver,
'mouseout' : this.onMouseOut,
scope: this
});</code></pre>
Removes an event handler from this element. The shorthand version <a ext:cls="apf.Element" ext:member="un" href="output/apf.Element.html#un">un</a> is equivalent. Example:
<pre><code>el.removeListener('click', this.handlerFn);
// or
el.un('click', this.handlerFn);</code></pre>
the type of event to remove
the method the event invokes
(optional) The scope (The <tt>this</tt> reference) of the handler function. Defaults
to this Element.
Removes all previous added listeners from this element
Create an event handler on this element such that when the event fires and is handled by this element,
it will be relayed to another object (i.e., fired again as if it originated from that object instead).
The type of event to relay
Any object that extends <a ext:cls="apf.util.Observable" href="output/apf.util.Observable.html">apf.util.Observable</a> that will provide the context
for firing the relayed event
Set the opacity of the element
The new opacity. 0 = transparent, .5 = 50% visibile, 1 = fully visible, etc
(optional) true for the default animation or a standard Element animation config object
Gets the left X coordinate
True to get the local css position instead of page coordinate
Gets the right X coordinate of the element (element X position + element width)
True to get the local css position instead of page coordinate
Gets the top Y coordinate
True to get the local css position instead of page coordinate
Gets the bottom Y coordinate of the element (element Y position + element height)
True to get the local css position instead of page coordinate
Initializes positioning on this element. If a desired position is not passed, it will make the
the element positioned relative IF it is not already positioned.
(optional) Positioning to use "relative", "absolute" or "fixed"
(optional) The zIndex to apply
(optional) Set the page X position
(optional) Set the page Y position
Clear positioning back to the default when the document was loaded
(optional) The value to use for the left,right,top,bottom, defaults to '' (empty string). You could use 'auto'.
Gets an object with all CSS positioning properties. Useful along with setPostioning to get
snapshot before performing an update and then restoring the element.
Gets the width of the border(s) for the specified side(s)
Can be t, l, r, b or any combination of those to add multiple values. For example,
passing lr would get the border (l)eft width + the border (r)ight width.
Gets the width of the padding(s) for the specified side(s)
Can be t, l, r, b or any combination of those to add multiple values. For example,
passing lr would get the padding (l)eft + the padding (r)ight.
Set positioning with an object returned by getPositioning().
Quick set left and top adding default units
The left CSS property value
The top CSS property value
Move this element relative to its current position.
Possible values are: "l" (or "left"), "r" (or "right"), "t" (or "top", or "up"), "b" (or "bottom", or "down").
How far to move the element in pixels
(optional) true for the default animation or a standard Element animation config object
Store the current overflow setting and clip overflow on the element - use <a ext:cls="apf.Element" ext:member="unclip" href="output/apf.Element.html#unclip">unclip</a> to remove
Return clipping (overflow) to original clipping before clip() was called
Gets the x,y coordinates specified by the anchor position on the element.
(optional) The specified anchor position (defaults to "c"). See <a ext:cls="apf.Element" ext:member="alignTo" href="output/apf.Element.html#alignTo">alignTo</a>
for details on supported anchor positions.
(optional) True to get the local (element top/left-relative) anchor position instead
of page coordinates
(optional) An object containing the size to use for calculating anchor position
{width: (target width), height: (target height)} (defaults to the element's current size)
Gets the x,y coordinates to align this element with another element. See <a ext:cls="apf.Element" ext:member="alignTo" href="output/apf.Element.html#alignTo">alignTo</a> for more info on the
supported position values.
The element to align to.
The position to align to.
(optional) Offset the positioning by [x, y]
Aligns this element with another element relative to the specified anchor points. If the other element is the
document it aligns it to the viewport.
The position parameter is optional, and can be specified in any one of the following formats:
<ul>
<li><b>Blank</b>: Defaults to aligning the element's top-left corner to the target's bottom-left corner ("tl-bl").</li>
<li><b>One anchor (deprecated)</b>: The passed anchor position is used as the target element's anchor point.
The element being aligned will position its top-left corner (tl) to that point. <i>This method has been
deprecated in favor of the newer two anchor syntax below</i>.</li>
<li><b>Two anchors</b>: If two values from the table below are passed separated by a dash, the first value is used as the
element's anchor point, and the second value is used as the target's anchor point.</li>
</ul>
In addition to the anchor points, the position parameter also supports the "?" character. If "?" is passed at the end of
the position string, the element will attempt to align as specified, but the position will be adjusted to constrain to
the viewport if necessary. Note that the element being aligned might be swapped to align to a different position than
that specified in order to enforce the viewport constraints.
Following are all of the supported anchor positions:
<pre>Value Description
----- -----------------------------
tl The top left corner (default)
t The center of the top edge
tr The top right corner
l The center of the left edge
c In the center of the element
r The center of the right edge
bl The bottom left corner
b The center of the bottom edge
br The bottom right corner</pre>
Example Usage:
<pre><code>// align el to other-el using the default positioning ("tl-bl", non-constrained)
el.alignTo("other-el");
// align the top left corner of el with the top right corner of other-el (constrained to viewport)
el.alignTo("other-el", "tr?");
// align the bottom right corner of el with the center left edge of other-el
el.alignTo("other-el", "br-l?");
// align the center of el with the bottom left corner of other-el and
// adjust the x position by -6 pixels (and the y position by 0)
el.alignTo("other-el", "c-bl", [-6, 0]);</code></pre>
The element to align to.
The position to align to.
(optional) Offset the positioning by [x, y]
(optional) true for the default animation or a standard Element animation config object
Anchors an element to another element and realigns it when the window is resized.
The element to align to.
The position to align to.
(optional) Offset the positioning by [x, y]
(optional) True for the default animation or a standard Element animation config object
(optional) True to monitor body scroll and reposition. If this parameter
is a number, it is used as the buffer delay (defaults to 50ms).
The function to call after the animation finishes
Clears any opacity settings from this element. Required in some cases for IE.
Hide this element - Uses display mode to determine whether to use "display" or "visibility". See <a ext:cls="apf.Element" ext:member="setVisible" href="output/apf.Element.html#setVisible">setVisible</a>.
(optional) true for the default animation or a standard Element animation config object
Show this element - Uses display mode to determine whether to use "display" or "visibility". See <a ext:cls="apf.Element" ext:member="setVisible" href="output/apf.Element.html#setVisible">setVisible</a>.
(optional) true for the default animation or a standard Element animation config object
Update the innerHTML of this element, optionally searching for and processing scripts
The new HTML
(optional) True to look for and process scripts (defaults to false)
(optional) For async script loading you can be notified when the update completes
Direct access to the Updater <a ext:cls="apf.Updater" ext:member="update" href="output/apf.Updater.html#update">apf.Updater.update</a> method. The method takes the same object
parameter as <a ext:cls="apf.Updater" ext:member="update" href="output/apf.Updater.html#update">apf.Updater.update</a>
Gets this element's Updater
Disables text selection for this element (normalized across browsers)
Calculates the x, y to center this element on the screen
Centers the Element in either the viewport, or another Element.
(optional) The element in which to center the element.
Tests various css rules/browsers to determine if this element uses a border box
Return a box {x, y, width, height} that can be used to set another elements
size/location to match this element.
(optional) If true a box for the content of the element is returned.
(optional) If true the element's left and top are returned instead of page x/y.
Returns the sum width of the padding and borders for the passed "sides". See getBorderWidth()
for more information about the sides.
Sets the element's box. Use getBox() on another element to get a box obj. If animate is true then width, height, x and y will be animated concurrently.
The box to fill {x, y, width, height}
(optional) Whether to adjust for box-model issues automatically
(optional) true for the default animation or a standard Element animation config object
Forces the browser to repaint this element
Returns an object with properties top, left, right and bottom representing the margins of this element unless sides is passed,
then it returns the calculated width of the sides (see getPadding)
(optional) Any combination of l, r, t, b to get the sum of those sides
Creates a proxy element of this element
The class name of the proxy element or a DomHelper config object
(optional) The element or element id to render the proxy to (defaults to document.body)
(optional) True to align and size the proxy to this element now (defaults to false)
Puts a mask over this element to disable user interaction. Requires core.css.
This method can only be applied to elements which accept child nodes.
(optional) A message to display in the mask
(optional) A css class to apply to the msg element
Removes a previously applied mask.
Returns true if this element is masked
Creates an iframe shim for this element to keep selects and other windowed objects from
showing through.
Removes this element from the DOM and deletes it from the cache
Sets up event handlers to call the passed functions when the mouse is over this element. Automatically
filters child element mouse events.
(optional)
Sets up event handlers to add and remove a css class when the mouse is over this element
Sets up event handlers to add and remove a css class when this element has the focus
Sets up event handlers to add and remove a css class when the mouse is down and then up on this element (a click effect)
Stops the specified event from bubbling and optionally prevents the default action
(optional) true to prevent the default action too
Gets the parent node for this element, optionally chaining up trying to match a selector
(optional) Find a parent node that matches the passed simple selector
(optional) True to return a raw dom node instead of an apf.Element
Gets the next sibling, skipping text nodes
(optional) Find the next sibling that matches the passed simple selector
(optional) True to return a raw dom node instead of an apf.Element
Gets the previous sibling, skipping text nodes
(optional) Find the previous sibling that matches the passed simple selector
(optional) True to return a raw dom node instead of an apf.Element
Gets the first child, skipping text nodes
(optional) Find the next sibling that matches the passed simple selector
(optional) True to return a raw dom node instead of an apf.Element
Gets the last child, skipping text nodes
(optional) Find the previous sibling that matches the passed simple selector
(optional) True to return a raw dom node instead of an apf.Element
Appends the passed element(s) to this element
Creates the passed DomHelper config and appends it to this element or optionally inserts it before the passed child element.
DomHelper element config object. If no tag is specified (e.g., {tag:'input'}) then a div will be
automatically generated with the specified attributes.
(optional) a child element of this element
(optional) true to return the dom node instead of creating an Element
Appends this element to the passed element
The new parent element
Inserts this element before the passed element in the DOM
The element before which this element will be inserted
Inserts this element after the passed element in the DOM
The element to insert after
Inserts (or creates) an element (or DomHelper config) as the first child of this element
The id or element to insert or a DomHelper config to create and insert
Inserts (or creates) the passed element (or DomHelper config) as a sibling of this element
The id, element to insert or a DomHelper config to create and insert *or* an array of any of those.
(optional) 'before' or 'after' defaults to before
(optional) True to return the raw DOM element instead of apf.Element
Creates and wraps this element with another element
(optional) DomHelper element config object for the wrapper element or null for an empty div
(optional) True to return the raw DOM element instead of apf.Element
Replaces the passed element with this element
The element to replace
Replaces this element with the passed element
The new element or a DomHelper config of an element to create
Inserts an html fragment into this element
Where to insert the html in relation to this element - beforeBegin, afterBegin, beforeEnd, afterEnd.
The HTML fragment
(optional) True to return an apf.Element (defaults to false)
Sets the passed attributes as attributes of this element (a style attribute can be a string, object or function)
The object with the attributes
(optional) false to override the default setAttribute to use expandos.
Convenience method for constructing a KeyMap
Either a string with the keys to listen for, the numeric key code, array of key codes or an object with the following options:
{key: (number or array), shift: (true/false), ctrl: (true/false), alt: (true/false)}
The function to call
(optional) The scope of the function
Creates a KeyMap for this element
The KeyMap config. See <a ext:cls="apf.KeyMap" href="output/apf.KeyMap.html">apf.KeyMap</a> for more details
Returns true if this element is scrollable.
Scrolls this element the specified scroll point. It does NOT do bounds checking so if you scroll to a weird value it will try to do it. For auto bounds checking, use scroll().
Either "left" for scrollLeft values or "top" for scrollTop values.
The new scroll value
(optional) true for the default animation or a standard Element animation config object
Scrolls this element the specified direction. Does bounds checking to make sure the scroll is
within this element's scrollable range.
Possible values are: "l" (or "left"), "r" (or "right"), "t" (or "top", or "up"), "b" (or "bottom", or "down").
How far to scroll the element in pixels
(optional) true for the default animation or a standard Element animation config object
Translates the passed page coordinates into left/top css values for this element
The page x or an array containing [x, y]
(optional) The page y, required if x is not an array
Returns the current scroll position of the element.
Return the CSS color for the specified CSS attribute. rgb, 3 digit (like #fff) and valid values
are convert to standard 6 digit hex color.
The css attribute
The default value to use when a valid color isn't found
(optional) defaults to #. Use an empty string when working with
color anims.
Wraps the specified element with a special markup/CSS block that renders by default as a gray container with a
gradient background, rounded corners and a 4-way shadow. Example usage:
<pre><code>
// Basic box wrap
apf.get("foo").boxWrap();
// You can also add a custom class and use CSS inheritance rules to customize the box look.
// 'x-box-blue' is a built-in alternative -- look at the related CSS definitions as an example
// for how to create a custom box wrap style.
apf.get("foo").boxWrap().addClass("x-box-blue");</pre></code>
(optional) A base CSS class to apply to the containing wrapper element (defaults to 'x-box').
Note that there are a number of CSS rules that are dependent on this name to make the overall effect work,
so if you supply an alternate base class, make sure you also supply all of the necessary rules.
Returns the value of a namespaced attribute from the element's underlying DOM node.
The namespace in which to look for the attribute
The attribute name
Returns the width in pixels of the passed text, or the width of the text in this Element.
The text to measure. Defaults to the innerHTML of the element.
(Optional) The minumum value to return.
(Optional) The maximum value to return.
<static> Static method to retrieve apf.Element objects.
<p><b>This method does not retrieve <a ext:cls="apf.Component" href="output/apf.Component.html">Component</a>s.</b> This method
retrieves apf.Element objects which encapsulate DOM elements. To retrieve a Component by
its ID, use <a ext:cls="apf.ComponentMgr" ext:member="get" href="output/apf.ComponentMgr.html#get">apf.ComponentMgr.get</a>.</p>
<p>Uses simple caching to consistently return the same object.
Automatically fixes if an object was recreated with the same id via AJAX or DOM.</p>
The id of the node, a DOM Node or an existing Element.
<static> Gets the globally shared flyweight Element, with the passed node as the active element. Do not store a reference to this element -
the dom node can be overwritten by other code.
The dom node or id
(optional) Allows for creation of named reusable flyweights to
prevent conflicts (e.g. internally apf uses "_internal")
Appends an event handler (shorthand for <a ext:cls="apf.Element" ext:member="addListener" href="output/apf.Element.html#addListener">addListener</a>).
The type of event to handle
The handler function the event invokes
(optional) The scope (this element) of the handler function
(optional) An object containing standard <a ext:cls="apf.Element" ext:member="addListener" href="output/apf.Element.html#addListener">addListener</a> options
Removes an event handler from this element (shorthand for <a ext:cls="apf.Element" ext:member="removeListener" href="output/apf.Element.html#removeListener">removeListener</a>).
the type of event to remove
the method the event invokes
Registers event handlers that want to receive a normalized EventObject instead of the standard browser event and provides
several useful events directly.
See <a ext:cls="apf.EventObject" href="output/apf.EventObject.html">apf.EventObject</a> for more details on normalized event objects.<br><br><i>This class is a singleton and cannot be created directly.</i>
Url used for onDocumentReady with using SSL (defaults to apf.SSL_SECURE_URL)
The frequency, in milliseconds, to check for text resize events (defaults to 50)
Appends an event handler to an element. The shorthand version <a ext:cls="apf.EventManager" ext:member="on" href="output/apf.EventManager.html#on">on</a> is equivalent. Typically you will
use <a ext:cls="apf.Element" ext:member="addListener" href="output/apf.Element.html#addListener">apf.Element.addListener</a> directly on an Element in favor of calling this version.
The html element or id to assign the event handler to
The type of event to listen for
The handler function the event invokes This function is passed
the following parameters:<ul>
<li>evt : EventObject<div class="sub-desc">The <a ext:cls="apf.EventObject" href="output/apf.EventObject.html">EventObject</a> describing the event.</div></li>
<li>t : Element<div class="sub-desc">The <a ext:cls="apf.Element" href="output/apf.Element.html">Element</a> which was the target of the event.
Note that this may be filtered by using the <tt>delegate</tt> option.</div></li>
<li>o : Object<div class="sub-desc">The options object from the addListener call.</div></li>
</ul>
(optional) The scope in which to execute the handler
function (the handler function's "this" context)
(optional) An object containing handler configuration properties.
This may contain any of the following properties:<ul>
<li>scope {Object} : The scope in which to execute the handler function. The handler function's "this" context.</li>
<li>delegate {String} : A simple selector to filter the target or look for a descendant of the target</li>
<li>stopEvent {Boolean} : True to stop the event. That is stop propagation, and prevent the default action.</li>
<li>preventDefault {Boolean} : True to prevent the default action</li>
<li>stopPropagation {Boolean} : True to prevent event propagation</li>
<li>normalized {Boolean} : False to pass a browser event to the handler function instead of an apf.EventObject</li>
<li>delay {Number} : The number of milliseconds to delay the invocation of the handler after te event fires.</li>
<li>single {Boolean} : True to add a handler to handle just the next firing of the event, and then remove itself.</li>
<li>buffer {Number} : Causes the handler to be scheduled to run in an <a ext:cls="apf.util.DelayedTask" href="output/apf.util.DelayedTask.html">apf.util.DelayedTask</a> delayed
by the specified number of milliseconds. If the event fires again within that time, the original
handler is <em>not</em> invoked, but the new handler is scheduled in its place.</li>
</ul><br>
<p>See <a ext:cls="apf.Element" ext:member="addListener" href="output/apf.Element.html#addListener">apf.Element.addListener</a> for examples of how to use these options.</p>
Removes an event handler from an element. The shorthand version <a ext:cls="apf.EventManager" ext:member="un" href="output/apf.EventManager.html#un">un</a> is equivalent. Typically
you will use <a ext:cls="apf.Element" ext:member="removeListener" href="output/apf.Element.html#removeListener">apf.Element.removeListener</a> directly on an Element in favor of calling this version.
The id or html element from which to remove the event
The type of event
The handler function to remove
Removes all event handers from an element. Typically you will use <a ext:cls="apf.Element" ext:member="removeAllListeners" href="output/apf.Element.html#removeAllListeners">apf.Element.removeAllListeners</a>
directly on an Element in favor of calling this version.
The id or html element from which to remove the event
Fires when the document is ready (before onload and before images are loaded). Can be
accessed shorthanded as apf.onReady().
The method the event invokes
(optional) An object that becomes the scope of the handler
(optional) An object containing standard <a ext:cls="apf.EventManager" ext:member="addListener" href="output/apf.EventManager.html#addListener">addListener</a> options
Fires when the window is resized and provides resize event buffering (50 milliseconds), passes new viewport width and height to handlers.
The method the event invokes
An object that becomes the scope of the handler
Fires when the user changes the active text size. Handler gets called with 2 params, the old size and the new size.
The method the event invokes
An object that becomes the scope of the handler
Removes the passed window resize listener.
The method the event invokes
The scope of handler
Appends an event handler to an element. Shorthand for <a ext:cls="apf.EventManager" ext:member="addListener" href="output/apf.EventManager.html#addListener">addListener</a>.
The html element or id to assign the event handler to
The type of event to listen for
The handler function the event invokes
(optional) The scope in which to execute the handler
function (the handler function's "this" context)
(optional) An object containing standard <a ext:cls="apf.EventManager" ext:member="addListener" href="output/apf.EventManager.html#addListener">addListener</a> options
Removes an event handler from an element. Shorthand for <a ext:cls="apf.EventManager" ext:member="removeListener" href="output/apf.EventManager.html#removeListener">removeListener</a>.
The id or html element from which to remove the event
The type of event
The handler function to remove
EventObject exposes the Yahoo! UI Event functionality directly on the object
passed to your event handler. It exists mostly for convenience. It also fixes the annoying null checks automatically to cleanup your code
Example:
<pre><code>function handleClick(e){ // e is not a standard event object, it is a apf.EventObject
e.preventDefault();
var target = e.getTarget();
...
}
var myDiv = apf.get("myDiv");
myDiv.on("click", handleClick);
//or
apf.EventManager.on("myDiv", 'click', handleClick);
apf.EventManager.addListener("myDiv", 'click', handleClick);</code></pre><br><br><i>This class is a singleton and cannot be created directly.</i>
The normal browser event
The button pressed in a mouse event
True if the shift key was down during the event
True if the control key was down during the event
True if the alt key was down during the event
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Key constant
Stop the event (preventDefault and stopPropagation)
Prevents the browsers default handling of the event.
Cancels bubbling of the event.
Gets the character code for the event.
Returns a normalized keyCode for the event.
Gets the x coordinate of the event.
Gets the y coordinate of the event.
Gets the time of the event.
Gets the page coordinates of the event.
Gets the target for the event.
(optional) A simple selector to filter the target or look for an ancestor of the target
(optional) The max depth to
search as a number or element (defaults to 10 || document.body)
(optional) True to return a apf.Element object instead of DOM node
Gets the related target.
Normalizes mouse wheel delta across browsers
Returns true if the control, meta, shift or alt key was pressed during this event.
Returns true if the target of this event is a child of el. If the target is el, it returns false.
Example usage:<pre><code>// Handle click on any child of an element
apf.getBody().on('click', function(e){
if(e.within('some-el')){
alert('Clicked on a child of some-el!');
}
});
// Handle click directly on an element, ignoring clicks on child nodes
apf.getBody().on('click', function(e,t){
if((t.id == 'some-el') && !e.within(t, true)){
alert('Clicked directly on some-el!');
}
});</code></pre>
The id, DOM element or apf.Element to check
(optional) true to test if the related target is within el instead of the target
<p>A class to provide basic animation and visual effects support. <b>Note:</b> This class is automatically applied
to the <a ext:cls="apf.Element" href="output/apf.Element.html">apf.Element</a> interface when included, so all effects calls should be performed via Element.
Conversely, since the effects are not actually defined in Element, apf.Fx <b>must</b> be included in order for the
Element effects to work.</p><br/>
<p>It is important to note that although the Fx methods and many non-Fx Element methods support "method chaining" in that
they return the Element object itself as the method return value, it is not always possible to mix the two in a single
method chain. The Fx methods use an internal effects queue so that each effect can be properly timed and sequenced.
Non-Fx methods, on the other hand, have no such internal queueing and will always execute immediately. For this reason,
while it may be possible to mix certain Fx and non-Fx method calls in a single chain, it may not always provide the
expected results and should be done with care.</p><br/>
<p>Motion effects support 8-way anchoring, meaning that you can choose one of 8 different anchor points on the Element
that will serve as either the start or end point of the animation. Following are all of the supported anchor positions:</p>
<pre>Value Description
----- -----------------------------
tl The top left corner
t The center of the top edge
tr The top right corner
l The center of the left edge
r The center of the right edge
bl The bottom left corner
b The center of the bottom edge
br The bottom right corner</pre>
<b>Although some Fx methods accept specific custom config parameters, the ones shown in the Config Options section
below are common options that can be passed to any Fx method.</b>
Slides the element into view. An anchor point can be optionally passed to set the point of
origin for the slide effect. This function automatically handles wrapping the element with
a fixed-size container if needed. See the Fx class overview for valid anchor point options.
Usage:
<pre><code>// default: slide the element in from the top
el.slideIn();
// custom: slide the element in from the right with a 2-second duration
el.slideIn('r', { duration: 2 });
// common config options shown with default values
el.slideIn('t', {
easing: 'easeOut',
duration: .5
});</code></pre>
(optional) One of the valid Fx anchor positions (defaults to top: 't')
(optional) Object literal with any of the Fx config options
Slides the element out of view. An anchor point can be optionally passed to set the end point
for the slide effect. When the effect is completed, the element will be hidden (visibility =
'hidden') but block elements will still take up space in the document. The element must be removed
from the DOM using the 'remove' config option if desired. This function automatically handles
wrapping the element with a fixed-size container if needed. See the Fx class overview for valid anchor point options.
Usage:
<pre><code>// default: slide the element out to the top
el.slideOut();
// custom: slide the element out to the right with a 2-second duration
el.slideOut('r', { duration: 2 });
// common config options shown with default values
el.slideOut('t', {
easing: 'easeOut',
duration: .5,
remove: false,
useDisplay: false
});</code></pre>
(optional) One of the valid Fx anchor positions (defaults to top: 't')
(optional) Object literal with any of the Fx config options
Fades the element out while slowly expanding it in all directions. When the effect is completed, the
element will be hidden (visibility = 'hidden') but block elements will still take up space in the document.
The element must be removed from the DOM using the 'remove' config option if desired.
Usage:
<pre><code>// default
el.puff();
// common config options shown with default values
el.puff({
easing: 'easeOut',
duration: .5,
remove: false,
useDisplay: false
});</code></pre>
(optional) Object literal with any of the Fx config options
Blinks the element as if it was clicked and then collapses on its center (similar to switching off a television).
When the effect is completed, the element will be hidden (visibility = 'hidden') but block elements will still
take up space in the document. The element must be removed from the DOM using the 'remove' config option if desired.
Usage:
<pre><code>// default
el.switchOff();
// all config options shown with default values
el.switchOff({
easing: 'easeIn',
duration: .3,
remove: false,
useDisplay: false
});</code></pre>
(optional) Object literal with any of the Fx config options
Highlights the Element by setting a color (applies to the background-color by default, but can be
changed using the "attr" config option) and then fading back to the original color. If no original
color is available, you should provide the "endColor" config option which will be cleared after the animation.
Usage:
<pre><code>// default: highlight background to yellow
el.highlight();
// custom: highlight foreground text to blue for 2 seconds
el.highlight("0000ff", { attr: 'color', duration: 2 });
// common config options shown with default values
el.highlight("ffff9c", {
attr: "background-color", //can be any valid CSS property (attribute) that supports a color value
endColor: (current color) or "ffffff",
easing: 'easeIn',
duration: 1
});</code></pre>
(optional) The highlight color. Should be a 6 char hex color without the leading # (defaults to yellow: 'ffff9c')
(optional) Object literal with any of the Fx config options
Shows a ripple of exploding, attenuating borders to draw attention to an Element.
Usage:
<pre><code>// default: a single light blue ripple
el.frame();
// custom: 3 red ripples lasting 3 seconds total
el.frame("ff0000", 3, { duration: 3 });
// common config options shown with default values
el.frame("C3DAF9", 1, {
duration: 1 //duration of entire animation (not each individual ripple)
// Note: Easing is not configurable and will be ignored if included
});</code></pre>
(optional) The color of the border. Should be a 6 char hex color without the leading # (defaults to light blue: 'C3DAF9').
(optional) The number of ripples to display (defaults to 1)
(optional) Object literal with any of the Fx config options
Creates a pause before any subsequent queued effects begin. If there are
no effects queued after the pause it will have no effect.
Usage:
<pre><code>el.pause(1);</code></pre>
The length of time to pause (in seconds)
Fade an element in (from transparent to opaque). The ending opacity can be specified
using the "endOpacity" config option.
Usage:
<pre><code>// default: fade in from opacity 0 to 100%
el.fadeIn();
// custom: fade in from opacity 0 to 75% over 2 seconds
el.fadeIn({ endOpacity: .75, duration: 2});
// common config options shown with default values
el.fadeIn({
endOpacity: 1, //can be any value between 0 and 1 (e.g. .5)
easing: 'easeOut',
duration: .5
});</code></pre>
(optional) Object literal with any of the Fx config options
Fade an element out (from opaque to transparent). The ending opacity can be specified
using the "endOpacity" config option. Note that IE may require useDisplay:true in order
to redisplay correctly.
Usage:
<pre><code>// default: fade out from the element's current opacity to 0
el.fadeOut();
// custom: fade out from the element's current opacity to 25% over 2 seconds
el.fadeOut({ endOpacity: .25, duration: 2});
// common config options shown with default values
el.fadeOut({
endOpacity: 0, //can be any value between 0 and 1 (e.g. .5)
easing: 'easeOut',
duration: .5,
remove: false,
useDisplay: false
});</code></pre>
(optional) Object literal with any of the Fx config options
Animates the transition of an element's dimensions from a starting height/width
to an ending height/width.
Usage:
<pre><code>// change height and width to 100x100 pixels
el.scale(100, 100);
// common config options shown with default values. The height and width will default to
// the element's existing values if passed as null.
el.scale(
[element's width],
[element's height], {
easing: 'easeOut',
duration: .35
}
);</code></pre>
The new width (pass undefined to keep the original width)
The new height (pass undefined to keep the original height)
(optional) Object literal with any of the Fx config options
Animates the transition of any combination of an element's dimensions, xy position and/or opacity.
Any of these properties not specified in the config object will not be changed. This effect
requires that at least one new dimension, position or opacity setting must be passed in on
the config object in order for the function to have any effect.
Usage:
<pre><code>// slide the element horizontally to x position 200 while changing the height and opacity
el.shift({ x: 200, height: 50, opacity: .8 });
// common config options shown with default values.
el.shift({
width: [element's width],
height: [element's height],
x: [element's x position],
y: [element's y position],
opacity: [element's opacity],
easing: 'easeOut',
duration: .35
});</code></pre>
Object literal with any of the Fx config options
Slides the element while fading it out of view. An anchor point can be optionally passed to set the
ending point of the effect.
Usage:
<pre><code>// default: slide the element downward while fading out
el.ghost();
// custom: slide the element out to the right with a 2-second duration
el.ghost('r', { duration: 2 });
// common config options shown with default values
el.ghost('b', {
easing: 'easeOut',
duration: .5,
remove: false,
useDisplay: false
});</code></pre>
(optional) One of the valid Fx anchor positions (defaults to bottom: 'b')
(optional) Object literal with any of the Fx config options
Ensures that all effects queued after syncFx is called on the element are
run concurrently. This is the opposite of <a ext:cls="apf.Fx" ext:member="sequenceFx" href="output/apf.Fx.html#sequenceFx">sequenceFx</a>.
Ensures that all effects queued after sequenceFx is called on the element are
run in sequence. This is the opposite of <a ext:cls="apf.Fx" ext:member="syncFx" href="output/apf.Fx.html#syncFx">syncFx</a>.
Returns true if the element has any effects actively running or queued, else returns false.
Stops any running effects and clears the element's internal effects queue if it contains
any additional effects that haven't started yet.
Returns true if the element is currently blocking so that no other effect can be queued
until this effect is finished, else returns false if blocking is not set. This is commonly
used to ensure that an effect initiated by a user action runs to completion prior to the
same effect being restarted (e.g., firing only one effect even if the user clicks several times).
History management component that allows you to register arbitrary tokens that signify application
history state on navigation actions. You can then handle the history <a ext:cls="apf.History" ext:member="change" href="output/apf.History.html#change">change</a> event in order
to reset your application UI to the appropriate state when the user navigates forward or backward through
the browser history stack.<br><br><i>This class is a singleton and cannot be created directly.</i>
The id of the hidden field required for storing the current history token.
The id of the iframe required by IE to manage the history stack.
Initialize the global History instance.
(optional) A callback function that will be called once the history
component is fully initialized.
(optional) The callback scope
Add a new token to the history stack. This can be any arbitrary value, although it would
commonly be the concatenation of a component id and another id marking the specifc history
state of that component. Example usage:
<pre><code>// Handle tab changes on a TabPanel
tabPanel.on('tabchange', function(tabPanel, tab){
apf.History.add(tabPanel.id + ':' + tab.id);
});</code></pre>
The value that defines a particular application-specific history state
When true, if the passed token matches the current token
it will not save a new history step. Set to false if the same state can be saved more than once
at the same history stack location (defaults to true).
Programmatically steps back one step in browser history (equivalent to the user pressing the Back button).
Programmatically steps forward one step in browser history (equivalent to the user pressing the Forward button).
Retrieves the currently-active history token.
Handles mapping keys to actions for an element. One key map can be used for multiple actions.
The constructor accepts the same config object as defined by <a ext:cls="apf.KeyMap" ext:member="addBinding" href="output/apf.KeyMap.html#addBinding">addBinding</a>.
If you bind a callback function to a KeyMap, anytime the KeyMap handles an expected key
combination it will call the function with this signature (if the match is a multi-key
combination the callback will still be called only once): (String key, apf.EventObject e)
A KeyMap can also handle a string representation of keys.<br />
Usage:
<pre><code>// map one key by key code
var map = new apf.KeyMap("my-element", {
key: 13, // or apf.EventObject.ENTER
fn: myHandler,
scope: myObject
});
// map multiple keys to one action by string
var map = new apf.KeyMap("my-element", {
key: "a\r\n\t",
fn: myHandler,
scope: myObject
});
// map multiple keys to multiple actions by strings and array of codes
var map = new apf.KeyMap("my-element", [
{
key: [10,13],
fn: function(){ alert("Return was pressed"); }
}, {
key: "abc",
fn: function(){ alert('a, b or c was pressed'); }
}, {
key: "\t",
ctrl:true,
shift:true,
fn: function(){ alert('Control + shift + tab was pressed.'); }
}
]);</code></pre>
<b>Note: A KeyMap starts enabled</b>
The element to bind to
The config (see <a ext:cls="apf.KeyMap" ext:member="addBinding" href="output/apf.KeyMap.html#addBinding">addBinding</a>)
(optional) The event to bind to (defaults to "keydown")
True to stop the event from bubbling and prevent the default browser action if the
key was handled by the KeyMap (defaults to false)
Add a new binding to this KeyMap. The following config object properties are supported:
<pre>Property Type Description
---------- --------------- ----------------------------------------------------------------------
key String/Array A single keycode or an array of keycodes to handle
shift Boolean True to handle key only when shift is pressed (defaults to false)
ctrl Boolean True to handle key only when ctrl is pressed (defaults to false)
alt Boolean True to handle key only when alt is pressed (defaults to false)
handler Function The function to call when KeyMap finds the expected key combination
fn Function Alias of handler (for backwards-compatibility)
scope Object The scope of the callback function
stopEvent Boolean True to stop the event</pre>
Usage:
<pre><code>// Create a KeyMap
var map = new apf.KeyMap(document, {
key: apf.EventObject.ENTER,
fn: handleKey,
scope: this
});
//Add a new binding to the existing KeyMap later
map.addBinding({
key: 'abc',
shift: true,
fn: handleKey,
scope: this
});</code></pre>
A single KeyMap config or an array of configs
Shorthand for adding a single key listener
Either the numeric key code, array of key codes or an object with the
following options:
{key: (number or array), shift: (true/false), ctrl: (true/false), alt: (true/false)}
The function to call
(optional) The scope of the function
Returns true if this KeyMap is enabled
Enables this KeyMap
Disable this KeyMap
<p>Provides a convenient wrapper for normalized keyboard navigation. KeyNav allows you to bind
navigation keys to function calls that will get called when the keys are pressed, providing an easy
way to implement custom navigation schemes for any UI component.</p>
<p>The following are all of the possible keys that can be implemented: enter, left, right, up, down, tab, esc,
pageUp, pageDown, del, home, end. Usage:</p>
<pre><code>var nav = new apf.KeyNav("my-element", {
"left" : function(e){
this.moveLeft(e.ctrlKey);
},
"right" : function(e){
this.moveRight(e.ctrlKey);
},
"enter" : function(e){
this.save();
},
scope : this
});</code></pre>
The element to bind to
The config
Enable this KeyNav
Disable this KeyNav
An extended <a ext:cls="apf.Element" href="output/apf.Element.html">apf.Element</a> object that supports a shadow and shim, constrain to viewport and
automatic maintaining of shadow/shim positions.
An object with config options.
(optional) Uses an existing DOM element. If the element is not found it creates it.
Sets the z-index of this layer and adjusts any shadow and shim z-indexes. The layer z-index is automatically
incremented by two more than the value passed in so that it always shows above any shadow or shim (the shadow
element, if any, will be assigned z-index + 1, and the shim element, if any, will be assigned the unmodified z-index).
The new z-index to set
A simple utility class for generically masking elements while loading data. If the <a ext:cls="apf.LoadMask" ext:member="store" href="output/apf.LoadMask.html#store">store</a>
config option is specified, the masking will be automatically synchronized with the store's loading
process and the mask element will be cached for reuse. For all other elements, this mask will replace the
element's Updater load indicator and will be destroyed after the initial load.
<p>Example usage:</p>
<pre><code>// Basic mask:
var myMask = new apf.LoadMask(apf.getBody(), {msg:"Please wait..."});
myMask.show();</code></pre>
Create a new LoadMask
The element or DOM node, or its id
The config object
Read-only. True if the mask is currently disabled so that it will not be displayed (defaults to false)
Disables the mask to prevent it from being displayed
Enables the mask so that it can be displayed
Show this LoadMask over the configured Element.
Hide this LoadMask.
<p>Utility class for generating different styles of message boxes. The alias apf.Msg can also be used.<p/>
<p>Note that the MessageBox is asynchronous. Unlike a regular JavaScript <code>alert</code> (which will halt
browser execution), showing a MessageBox will not cause the code to stop. For this reason, if you have code
that should only run <em>after</em> some user feedback from the MessageBox, you must use a callback function
(see the <code>function</code> parameter for <a ext:cls="apf.MessageBox" ext:member="show" href="output/apf.MessageBox.html#show">show</a> for more details).</p>
<p>Example usage:</p>
<pre><code>// Basic alert:
apf.Msg.alert('Status', 'Changes saved successfully.');
// Prompt for user data and process the result using a callback:
apf.Msg.prompt('Name', 'Please enter your name:', function(btn, text){
if (btn == 'ok'){
// process text value and close...
}
});
// Show a dialog using config options:
apf.Msg.show({
title:'Save Changes?',
msg: 'You are closing a tab that has unsaved changes. Would you like to save your changes?',
buttons: apf.Msg.YESNOCANCEL,
fn: processResult,
animEl: 'elId',
icon: apf.MessageBox.QUESTION
});</code></pre><br><br><i>This class is a singleton and cannot be created directly.</i>
Button config that displays a single OK button
Button config that displays a single Cancel button
Button config that displays OK and Cancel buttons
Button config that displays Yes and No buttons
Button config that displays Yes, No and Cancel buttons
The CSS class that provides the INFO icon image
The CSS class that provides the WARNING icon image
The CSS class that provides the QUESTION icon image
The CSS class that provides the ERROR icon image
The default height in pixels of the message box's multiline textarea if displayed (defaults to 75)
The maximum width in pixels of the message box (defaults to 600)
The minimum width in pixels of the message box (defaults to 100)
The minimum width in pixels of the message box if it is a progress-style dialog. This is useful
for setting a different minimum width than text-only dialogs may need (defaults to 250)
An object containing the default button text strings that can be overriden for localized language support.
Supported properties are: ok, cancel, yes and no. Generally you should include a locale-specific
resource file for handling language support across the framework.
Customize the default text like so: apf.MessageBox.buttonText.yes = "oui"; //french
Returns a reference to the underlying <a ext:cls="apf.Window" href="output/apf.Window.html">apf.Window</a> element
Updates the message box body text
(optional) Replaces the message box element's innerHTML with the specified string (defaults to
the XHTML-compliant non-breaking space character '&#160;')
Updates a progress-style message box's text and progress bar. Only relevant on message boxes
initiated via <a ext:cls="apf.MessageBox" ext:member="progress" href="output/apf.MessageBox.html#progress">apf.MessageBox.progress</a> or by calling <a ext:cls="apf.MessageBox" ext:member="show" href="output/apf.MessageBox.html#show">apf.MessageBox.show</a> with progress: true.
Any number between 0 and 1 (e.g., .5, defaults to 0)
The progress text to display inside the progress bar (defaults to '')
The message box's body text is replaced with the specified string (defaults to undefined
so that any existing body text will not get overwritten by default unless a new value is passed in)
Returns true if the message box is currently displayed
Hides the message box if it is displayed
Displays a new message box, or reinitializes an existing message box, based on the config options
passed in. All display functions (e.g. prompt, alert, etc.) on MessageBox call this function internally,
although those calls are basic shortcuts and do not support all of the config options allowed here.
The following config options are supported: <ul>
<li><b>animEl</b> : String/Element<div class="sub-desc">An id or Element from which the message box should animate as it
opens and closes (defaults to undefined)</div></li>
<li><b>buttons</b> : Object/Boolean<div class="sub-desc">A button config object (e.g., apf.MessageBox.OKCANCEL or {ok:'Foo',
cancel:'Bar'}), or false to not show any buttons (defaults to false)</div></li>
<li><b>closable</b> : Boolean<div class="sub-desc">False to hide the top-right close button (defaults to true). Note that
progress and wait dialogs will ignore this property and always hide the close button as they can only
be closed programmatically.</div></li>
<li><b>cls</b> : String<div class="sub-desc">A custom CSS class to apply to the message box's container element</div></li>
<li><b>defaultTextHeight</b> : Number<div class="sub-desc">The default height in pixels of the message box's multiline textarea
if displayed (defaults to 75)</div></li>
<li><b>fn</b> : Function<div class="sub-desc">A callback function which is called when the dialog is dismissed either
by clicking on the configured buttons, or on the dialog close button, or by pressing
the return button to enter input.
<p>Progress and wait dialogs will ignore this option since they do not respond to user
actions and can only be closed programmatically, so any required function should be called
by the same code after it closes the dialog. Parameters passed:<ul>
<li><b>buttonId</b> : String<div class="sub-desc">The ID of the button pressed, one of:<div class="sub-desc"><ul>
<li><tt>ok</tt></li>
<li><tt>yes</tt></li>
<li><tt>no</tt></li>
<li><tt>cancel</tt></li>
</ul></div></div></li>
<li><b>text</b> : String<div class="sub-desc">Value of the input field if either <tt>{@link #show-option-prompt prompt}</tt>
or <tt>{@link #show-option-multiline multiline}</tt> is true</div></li>
</p></div></li>
<li><b>scope</b> : Object<div class="sub-desc">The scope of the callback function</div></li>
<li><b>icon</b> : String<div class="sub-desc">A CSS class that provides a background image to be used as the body icon for the
dialog (e.g. apf.MessageBox.WARNING or 'custom-class') (defaults to '')</div></li>
<li><b>iconCls</b> : String<div class="sub-desc">The standard <a ext:cls="apf.Window" ext:member="iconCls" href="output/apf.Window.html#iconCls">apf.Window.iconCls</a> to
add an optional header icon (defaults to '')</div></li>
<li><b>maxWidth</b> : Number<div class="sub-desc">The maximum width in pixels of the message box (defaults to 600)</div></li>
<li><b>minWidth</b> : Number<div class="sub-desc">The minimum width in pixels of the message box (defaults to 100)</div></li>
<li><b>modal</b> : Boolean<div class="sub-desc">False to allow user interaction with the page while the message box is
displayed (defaults to true)</div></li>
<li><b>msg</b> : String<div class="sub-desc">A string that will replace the existing message box body text (defaults to the
XHTML-compliant non-breaking space character '&#160;')</div></li>
<a id="show-option-multiline"></a><li><b>multiline</b> : Boolean<div class="sub-desc">
True to prompt the user to enter multi-line text (defaults to false)</div></li>
<li><b>progress</b> : Boolean<div class="sub-desc">True to display a progress bar (defaults to false)</div></li>
<li><b>progressText</b> : String<div class="sub-desc">The text to display inside the progress bar if progress = true (defaults to '')</div></li>
<a id="show-option-prompt"></a><li><b>prompt</b> : Boolean<div class="sub-desc">True to prompt the user to enter single-line text (defaults to false)</div></li>
<li><b>proxyDrag</b> : Boolean<div class="sub-desc">True to display a lightweight proxy while dragging (defaults to false)</div></li>
<li><b>title</b> : String<div class="sub-desc">The title text</div></li>
<li><b>value</b> : String<div class="sub-desc">The string value to set into the active textbox element if displayed</div></li>
<li><b>wait</b> : Boolean<div class="sub-desc">True to display a progress bar (defaults to false)</div></li>
<li><b>waitConfig</b> : Object<div class="sub-desc">A <a ext:cls="apf.ProgressBar" ext:member="waitConfig" href="output/apf.ProgressBar.html#waitConfig">apf.ProgressBar.waitConfig</a> object (applies only if wait = true)</div></li>
<li><b>width</b> : Number<div class="sub-desc">The width of the dialog in pixels</div></li>
</ul>
Example usage:
<pre><code>apf.Msg.show({
title: 'Address',
msg: 'Please enter your address:',
width: 300,
buttons: apf.MessageBox.OKCANCEL,
multiline: true,
fn: saveAddress,
animEl: 'addAddressBtn',
icon: apf.MessageBox.INFO
});</code></pre>
Adds the specified icon to the dialog. By default, the class 'ext-mb-icon' is applied for default
styling, and the class passed in is expected to supply the background image url. Pass in empty string ('')
to clear any existing icon. The following built-in icon classes are supported, but you can also pass
in a custom class name:
<pre>apf.MessageBox.INFO
apf.MessageBox.WARNING
apf.MessageBox.QUESTION
apf.MessageBox.ERROR</pre>
A CSS classname specifying the icon's background image url, or empty string to clear the icon
Displays a message box with a progress bar. This message box has no buttons and is not closeable by
the user. You are responsible for updating the progress bar as needed via <a ext:cls="apf.MessageBox" ext:member="updateProgress" href="output/apf.MessageBox.html#updateProgress">apf.MessageBox.updateProgress</a>
and closing the message box when the process is complete.
The title bar text
The message box body text
(optional) The text to display inside the progress bar (defaults to '')
Displays a message box with an infinitely auto-updating progress bar. This can be used to block user
interaction while waiting for a long-running process to complete that does not have defined intervals.
You are responsible for closing the message box when the process is complete.
The message box body text
(optional) The title bar text
(optional) A <a ext:cls="apf.ProgressBar" ext:member="waitConfig" href="output/apf.ProgressBar.html#waitConfig">apf.ProgressBar.waitConfig</a> object
Displays a standard read-only message box with an OK button (comparable to the basic JavaScript alert prompt).
If a callback function is passed it will be called after the user clicks the button, and the
id of the button that was clicked will be passed as the only parameter to the callback
(could also be the top-right close button).
The title bar text
The message box body text
(optional) The callback function invoked after the message box is closed
(optional) The scope of the callback function
Displays a confirmation message box with Yes and No buttons (comparable to JavaScript's confirm).
If a callback function is passed it will be called after the user clicks either button,
and the id of the button that was clicked will be passed as the only parameter to the callback
(could also be the top-right close button).
The title bar text
The message box body text
(optional) The callback function invoked after the message box is closed
(optional) The scope of the callback function
Displays a message box with OK and Cancel buttons prompting the user to enter some text (comparable to JavaScript's prompt).
The prompt can be a single-line or multi-line textbox. If a callback function is passed it will be called after the user
clicks either button, and the id of the button that was clicked (could also be the top-right
close button) and the text that was entered will be passed as the two parameters to the callback.
The title bar text
The message box body text
(optional) The callback function invoked after the message box is closed
(optional) The scope of the callback function
(optional) True to create a multiline textbox using the defaultTextHeight
property, or the height in pixels to create the textbox (defaults to false / single-line)
(optional) Default value of the text input element (defaults to '')
A specialized toolbar that is bound to a <a ext:cls="apf.data.Store" href="output/apf.data.Store.html">apf.data.Store</a> and provides automatic paging controls.
Create a new PagingToolbar
The config object
Customizable piece of the default paging text (defaults to "Page")
Customizable piece of the default paging text (defaults to "of {0}"). Note that this string is
formatted using {0} as a token that is replaced by the number of total pages. This token should be
preserved when overriding this string if showing the total page count is desired.
Customizable piece of the default paging text (defaults to "First Page")
Customizable piece of the default paging text (defaults to "Previous Page")
Customizable piece of the default paging text (defaults to "Next Page")
Customizable piece of the default paging text (defaults to "Last Page")
Customizable piece of the default paging text (defaults to "Refresh")
Object mapping of parameter names for load calls (defaults to {start: 'start', limit: 'limit'})
Change the active page
The page to display
Unbinds the paging toolbar from the specified <a ext:cls="apf.data.Store" href="output/apf.data.Store.html">apf.data.Store</a>
The data store to unbind
Binds the paging toolbar to the specified <a ext:cls="apf.data.Store" href="output/apf.data.Store.html">apf.data.Store</a>
The data store to bind
Panel is a container that has specific functionality and structural components that make it the perfect building
block for application-oriented user interfaces. The Panel contains bottom and top toolbars, along with separate
header, footer and body sections. It also provides built-in expandable and collapsible behavior, along with a
variety of prebuilt tool buttons that can be wired up to provide other customized behavior. Panels can be easily
dropped into any Container or layout, and the layout and rendering pipeline is completely managed by the framework.
The config object
The Panel's header <a ext:cls="apf.Element" href="output/apf.Element.html">Element</a>. Read-only.
<p>This Element is used to house the <a ext:cls="apf.Panel" ext:member="title" href="output/apf.Panel.html#title">title</a> and <a ext:cls="apf.Panel" ext:member="tools" href="output/apf.Panel.html#tools">tools</a></p>
The Panel's body <a ext:cls="apf.Element" href="output/apf.Element.html">Element</a> which may be used to contain HTML content.
The content may be specified in the <a ext:cls="apf.Panel" ext:member="html" href="output/apf.Panel.html#html">html</a> config, or it may be loaded using the
<a ext:cls="autoLoad" href="output/autoLoad.html">autoLoad</a> config, or through the Panel's <a ext:cls="apf.Panel" ext:member="getUpdater" href="output/apf.Panel.html#getUpdater">Updater</a>. Read-only.
<p>If this is used to load visible HTML elements in either way, then
the Panel may not be used as a Layout for hosting nested Panels.</p>
<p>If this Panel is intended to be used as the host of a Layout (See <a ext:cls="apf.Panel" ext:member="layout" href="output/apf.Panel.html#layout">layout</a>
then the body Element must not be loaded or changed - it is under the control
of the Panel's Layout.
The Panel's footer <a ext:cls="apf.Element" href="output/apf.Element.html">Element</a>. Read-only.
<p>This Element is used to house the Panel's <a ext:cls="apf.Panel" ext:member="buttons" href="output/apf.Panel.html#buttons">buttons</a>.</p>
This Panel's Array of buttons as created from the <tt>buttons</tt>
config property. Read only.
<p>If this Panel is configured <a ext:cls="apf.Panel" ext:member="draggable" href="output/apf.Panel.html#draggable">draggable</a>, this property will contain
an instance of <a ext:cls="apf.dd.DragSource" href="output/apf.dd.DragSource.html">apf.dd.DragSource</a> which handles dragging the Panel.</p>
The developer must provide implementations of the abstract methods of <a ext:cls="apf.dd.DragSource" href="output/apf.dd.DragSource.html">apf.dd.DragSource</a>
in order to supply behaviour for each stage of the drag/drop process. See <a ext:cls="apf.Panel" ext:member="draggable" href="output/apf.Panel.html#draggable">draggable</a>.
Sets the CSS class that provides the icon image for this panel. This method will replace any existing
icon class if one has already been set.
The new CSS class name
Returns the toolbar from the top (tbar) section of the panel.
Returns the toolbar from the bottom (bbar) section of the panel.
Adds a button to this panel. Note that this method must be called prior to rendering. The preferred
approach is to add buttons via the <a ext:cls="apf.Panel" ext:member="buttons" href="output/apf.Panel.html#buttons">buttons</a> config.
A valid <a ext:cls="apf.Button" href="output/apf.Button.html">apf.Button</a> config. A string will become the text for a default
button config, an object will be treated as a button config object.
The function to be called on button <a ext:cls="apf.Button" ext:member="click" href="output/apf.Button.html#click">apf.Button.click</a>
The scope to use for the button handler function
Collapses the panel body so that it becomes hidden. Fires the <a ext:cls="apf.Panel" ext:member="beforecollapse" href="output/apf.Panel.html#beforecollapse">beforecollapse</a> event which will
cancel the collapse action if it returns false.
True to animate the transition, else false (defaults to the value of the
<a ext:cls="apf.Panel" ext:member="animCollapse" href="output/apf.Panel.html#animCollapse">animCollapse</a> panel config)
Expands the panel body so that it becomes visible. Fires the <a ext:cls="apf.Panel" ext:member="beforeexpand" href="output/apf.Panel.html#beforeexpand">beforeexpand</a> event which will
cancel the expand action if it returns false.
True to animate the transition, else false (defaults to the value of the
<a ext:cls="apf.Panel" ext:member="animCollapse" href="output/apf.Panel.html#animCollapse">animCollapse</a> panel config)
Shortcut for performing an <a ext:cls="apf.Panel" ext:member="expand" href="output/apf.Panel.html#expand">expand</a> or <a ext:cls="apf.Panel" ext:member="collapse" href="output/apf.Panel.html#collapse">collapse</a> based on the current state of the panel.
True to animate the transition, else false (defaults to the value of the
<a ext:cls="apf.Panel" ext:member="animCollapse" href="output/apf.Panel.html#animCollapse">animCollapse</a> panel config)
Returns the width in pixels of the framing elements of this panel (not including the body width). To
retrieve the body width see <a ext:cls="apf.Panel" ext:member="getInnerWidth" href="output/apf.Panel.html#getInnerWidth">getInnerWidth</a>.
Returns the height in pixels of the framing elements of this panel (including any top and bottom bars and
header and footer elements, but not including the body height). To retrieve the body height see <a ext:cls="apf.Panel" ext:member="getInnerHeight" href="output/apf.Panel.html#getInnerHeight">getInnerHeight</a>.
Returns the width in pixels of the body element (not including the width of any framing elements).
For the frame width see <a ext:cls="apf.Panel" ext:member="getFrameWidth" href="output/apf.Panel.html#getFrameWidth">getFrameWidth</a>.
Returns the height in pixels of the body element (not including the height of any framing elements).
For the frame height see <a ext:cls="apf.Panel" ext:member="getFrameHeight" href="output/apf.Panel.html#getFrameHeight">getFrameHeight</a>.
Sets the title text for the panel and optionally the icon class.
The title text to set
(optional) iconCls A user-defined CSS class that provides the icon image for this panel
Get the <a ext:cls="apf.Updater" href="output/apf.Updater.html">apf.Updater</a> for this panel. Enables you to perform Ajax updates of this panel's body.
Loads this content panel immediately with content returned from an XHR call.
A config object containing any of the following options:
<pre><code>panel.load({
url: "your-url.php",
params: {param1: "foo", param2: "bar"}, // or a URL encoded string
callback: yourFunction,
scope: yourObject, // optional scope for the callback
discardUrl: false,
nocache: false,
text: "Loading...",
timeout: 30,
scripts: false
});</code></pre>
The only required property is url. The optional properties nocache, text and scripts
are shorthand for disableCaching, indicatorText and loadScripts and are used to set their
associated property on this panel Updater instance.
<p>An updateable progress bar component. The progress bar supports two different modes: manual and automatic.</p>
<p>In manual mode, you are responsible for showing, updating (via <a ext:cls="apf.ProgressBar" ext:member="updateProgress" href="output/apf.ProgressBar.html#updateProgress">updateProgress</a>) and clearing the
progress bar as needed from your own code. This method is most appropriate when you want to show progress
throughout an operation that has predictable points of interest at which you can update the control.</p>
<p>In automatic mode, you simply call <a ext:cls="apf.ProgressBar" ext:member="wait" href="output/apf.ProgressBar.html#wait">wait</a> and let the progress bar run indefinitely, only clearing it
once the operation is complete. You can optionally have the progress bar wait for a specific amount of time
and then clear itself. Automatic mode is most appropriate for timed operations or asymchronous operations in
which you have no need for indicating intermediate progress.</p>
Updates the progress bar value, and optionally its text. If the text argument is not specified,
any existing text value will be unchanged. To blank out existing text, pass ''. Note that even
if the progress bar value exceeds 1, it will never automatically reset -- you are responsible for
determining when the progress is complete and calling <a ext:cls="apf.ProgressBar" ext:member="reset" href="output/apf.ProgressBar.html#reset">reset</a> to clear and/or hide the control.
(optional) A floating point value between 0 and 1 (e.g., .5, defaults to 0)
(optional) The string to display in the progress text element (defaults to '')
Initiates an auto-updating progress bar. A duration can be specified, in which case the progress
bar will automatically reset after a fixed amount of time and optionally call a callback function
if specified. If no duration is passed in, then the progress bar will run indefinitely and must
be manually cleared by calling <a ext:cls="apf.ProgressBar" ext:member="reset" href="output/apf.ProgressBar.html#reset">reset</a>. The wait method accepts a config object with
the following properties:
<pre>Property Type Description
---------- ------------ ----------------------------------------------------------------------
duration Number The length of time in milliseconds that the progress bar should
run before resetting itself (defaults to undefined, in which case it
will run indefinitely until reset is called)
interval Number The length of time in milliseconds between each progress update
(defaults to 1000 ms)
increment Number The number of progress update segments to display within the progress
bar (defaults to 10). If the bar reaches the end and is still
updating, it will automatically wrap back to the beginning.
text String Optional text to display in the progress bar element (defaults to '').
fn Function A callback function to execute after the progress bar finishes auto-
updating. The function will be called with no arguments. This function
will be ignored if duration is not specified since in that case the
progress bar can only be stopped programmatically, so any required function
should be called by the same code after it resets the progress bar.
scope Object The scope that is passed to the callback function (only applies when
duration and fn are both passed).</pre>
Example usage:
<pre><code>var p = new apf.ProgressBar({
renderTo: 'my-el'
});
//Wait for 5 seconds, then update the status el (progress bar will auto-reset)
p.wait({
interval: 100, //bar will move fast!
duration: 5000,
increment: 15,
text: 'Updating...',
scope: this,
fn: function(){
apf.fly('status').update('Done!');
}
});
//Or update indefinitely until some async action completes, then reset manually
p.wait();
myAction.on('complete', function(){
p.reset();
apf.fly('status').update('Done!');
});</code></pre>
(optional) Configuration options
Returns true if the progress bar is currently in a <a ext:cls="apf.ProgressBar" ext:member="wait" href="output/apf.ProgressBar.html#wait">wait</a> operation
Updates the progress bar text. If specified, textEl will be updated, otherwise the progress
bar itself will display the updated text.
(optional) The string to display in the progress text element (defaults to '')
Synchronizes the inner bar width to the proper proportion of the total componet width based
on the current progress <a ext:cls="apf.ProgressBar" ext:member="value" href="output/apf.ProgressBar.html#value">value</a>. This will be called automatically when the ProgressBar
is resized by a layout, but if it is rendered auto width, this method can be called from
another resize handler to sync the ProgressBar if necessary.
Sets the size of the progress bar.
The new width in pixels
The new height in pixels
Resets the progress bar value to 0 and text to empty string. If hide = true, the progress
bar will also be hidden (using the <a ext:cls="apf.ProgressBar" ext:member="hideMode" href="output/apf.ProgressBar.html#hideMode">hideMode</a> property internally).
(optional) True to hide the progress bar (defaults to false)
A specialized tooltip class for tooltips that can be specified in markup and automatically managed by the global
<a ext:cls="apf.QuickTips" href="output/apf.QuickTips.html">apf.QuickTips</a> instance. See the QuickTips class header for additional usage details and examples.
Create a new Tip
The configuration options
Configures a new quick tip instance and assigns it to a target element. The following config values are
supported (for example usage, see the <a ext:cls="apf.QuickTips" href="output/apf.QuickTips.html">apf.QuickTips</a> class header):
<div class="mdetail-params"><ul>
<li>autoHide</li>
<li>cls</li>
<li>dismissDelay (overrides the singleton value)</li>
<li>target (required)</li>
<li>text (required)</li>
<li>title</li>
<li>width</li></ul></div>
The config object
Removes this quick tip from its element and destroys it.
The element from which the quick tip is to be removed.
<p>Provides attractive and customizable tooltips for any element. The QuickTips
singleton is used to configure and manage tooltips globally for multiple elements
in a generic manner. To create individual tooltips with maximum customizability,
you should consider either <a ext:cls="apf.Tip" href="output/apf.Tip.html">apf.Tip</a> or <a ext:cls="apf.ToolTip" href="output/apf.ToolTip.html">apf.ToolTip</a>.</p>
<p>Quicktips can be configured via tag attributes directly in markup, or by
registering quick tips programmatically via the <a ext:cls="apf.QuickTips" ext:member="register" href="output/apf.QuickTips.html#register">register</a> method.</p>
<p>The singleton's instance of <a ext:cls="apf.QuickTip" href="output/apf.QuickTip.html">apf.QuickTip</a> is available via
<a ext:cls="apf.QuickTips" ext:member="getQuickTip" href="output/apf.QuickTips.html#getQuickTip">getQuickTip</a>, and supports all the methods, and all the all the
configuration properties of apf.QuickTip. These settings will apply to all
tooltips shown by the singleton.</p>
<p>Below is the summary of the configuration properties which can be used.
For detailed descriptions see <a ext:cls="apf.QuickTips" ext:member="getQuickTip" href="output/apf.QuickTips.html#getQuickTip">getQuickTip</a></p>
<p><b>QuickTips singleton configs (all are optional)</b></p>
<div class="mdetail-params"><ul><li>dismissDelay</li>
<li>hideDelay</li>
<li>maxWidth</li>
<li>minWidth</li>
<li>showDelay</li>
<li>trackMouse</li></ul></div>
<p><b>Target element configs (optional unless otherwise noted)</b></p>
<div class="mdetail-params"><ul><li>autoHide</li>
<li>cls</li>
<li>dismissDelay (overrides singleton value)</li>
<li>target (required)</li>
<li>text (required)</li>
<li>title</li>
<li>width</li></ul></div>
<p>Here is an example showing how some of these config options could be used:</p>
<pre><code>// Init the singleton. Any tag-based quick tips will start working.
apf.QuickTips.init();
// Apply a set of config properties to the singleton
apf.apply(apf.QuickTips.getQuickTip(), {
maxWidth: 200,
minWidth: 100,
showDelay: 50,
trackMouse: true
});
// Manually register a quick tip for a specific element
q.register({
target: 'my-div',
title: 'My Tooltip',
text: 'This tooltip was added in code',
width: 100,
dismissDelay: 20
});</code></pre>
<p>To register a quick tip in markup, you simply add one or more of the valid QuickTip attributes prefixed with
the <b>ext:</b> namespace. The HTML element itself is automatically set as the quick tip target. Here is the summary
of supported attributes (optional unless otherwise noted):</p>
<ul><li><b>hide</b>: Specifying "user" is equivalent to setting autoHide = false. Any other value will be the
same as autoHide = true.</li>
<li><b>qclass</b>: A CSS class to be applied to the quick tip (equivalent to the 'cls' target element config).</li>
<li><b>qtip (required)</b>: The quick tip text (equivalent to the 'text' target element config).</li>
<li><b>qtitle</b>: The quick tip title (equivalent to the 'title' target element config).</li>
<li><b>qwidth</b>: The quick tip width (equivalent to the 'width' target element config).</li></ul>
<p>Here is an example of configuring an HTML element to display a tooltip from markup:</p>
<pre><code>// Add a quick tip to an HTML button
<input type="button" value="OK" ext:qtitle="OK Button" ext:qwidth="100"
ext:qtip="This is a quick tip from markup!"></input></code></pre><br><br><i>This class is a singleton and cannot be created directly.</i>
Initialize the global QuickTips instance and prepare any quick tips.
True to render the QuickTips container immediately to preload images. (Defaults to true)
Enable quick tips globally.
Disable quick tips globally.
Returns true if quick tips are enabled, else false.
Gets the global QuickTips instance.
Configures a new quick tip instance and assigns it to a target element. See
<a ext:cls="apf.QuickTip" ext:member="register" href="output/apf.QuickTip.html#register">apf.QuickTip.register</a> for details.
The config object
Removes any registered quick tip from the target element and destroys it.
The element from which the quick tip is to be removed.
Alias of <a ext:cls="apf.QuickTips" ext:member="register" href="output/apf.QuickTips.html#register">register</a>.
The config object
<p>Applies drag handles to an element to make it resizable. The drag handles are inserted into the element
and positioned absolute. Some elements, such as a textarea or image, don't support this. To overcome that, you can wrap
the textarea in a div and set "resizeChild" to true (or to the id of the element), <b>or</b> set wrap:true in your config and
the element will be wrapped for you automatically.</p>
<p>Here is the list of valid resize handles:</p>
<pre>Value Description
------ -------------------
'n' north
's' south
'e' east
'w' west
'nw' northwest
'sw' southwest
'se' southeast
'ne' northeast
'all' all</pre>
<p>Here's an example showing the creation of a typical Resizable:</p>
<pre><code>var resizer = new apf.Resizable("element-id", {
handles: 'all',
minWidth: 200,
minHeight: 100,
maxWidth: 500,
maxHeight: 400,
pinned: true
});
resizer.on("resize", myHandler);</code></pre>
<p>To hide a particular handle, set its display to none in CSS, or through script:<br>
resizer.east.setDisplayed(false);</p>
Create a new resizable component
The id or element to resize
configuration options
The proxy Element that is resized in place of the real Element during the resize operation.
This may be queried using <a ext:cls="apf.Element" ext:member="getBox" href="output/apf.Element.html#getBox">apf.Element.getBox</a> to provide the new area to resize to.
Read only.
Perform a manual resize
<p>Performs resizing of the associated Element. This method is called internally by this
class, and should not be called by user code.</p>
<p>If a Resizable is being used to resize an Element which encapsulates a more complex UI
component such as a Panel, this method may be overridden by specifying an implementation
as a config option to provide appropriate behaviour at the end of the resize operation on
mouseup, for example resizing the Panel, and relaying the Panel's content.</p>
<p>The new area to be resized to is available by examining the state of the <a ext:cls="apf.Resizable" ext:member="proxy" href="output/apf.Resizable.html#proxy">proxy</a>
Element. Example:
<pre><code>new apf.Panel({
title: 'Resize me',
x: 100,
y: 100,
renderTo: apf.getBody(),
floating: true,
frame: true,
width: 400,
height: 200,
listeners: {
render: function(p) {
new apf.Resizable(p.getEl(), {
handles: 'all',
pinned: true,
transparent: true,
resizeElement: function() {
var box = this.proxy.getBox();
p.updateBox(box);
if (p.layout) {
p.doLayout();
}
return box;
}
});
}
}
}).show();</code></pre>
Returns the element this component is bound to.
Returns the resizeChild element (or null).
Destroys this resizable. If the element was wrapped and
removeEl is not true then the element remains.
(optional) true to remove the element from the DOM
Simple class that can provide a shadow effect for any element. Note that the element MUST be absolutely positioned,
and the shadow does not provide any shimming. This should be used only in simple cases -- for more advanced
functionality that can also provide the same shadow effect, see the <a ext:cls="apf.Layer" href="output/apf.Layer.html">apf.Layer</a> class.
Create a new Shadow
The config object
Displays the shadow under the target element
The id or element under which the shadow should display
Returns true if the shadow is visible, else false
Direct alignment when values are already available. Show must be called at least once before
calling this method to ensure it is initialized.
The target element left position
The target element top position
The target element width
The target element height
Hides this shadow
Adjust the z-index of this shadow
The new z-index
Slider which supports vertical or horizontal orientation, keyboard adjustments,
configurable snapping, axis clicking and animation. Can be added as an item to
any container. Example usage:
<pre><code>new apf.Slider({
renderTo: apf.getBody(),
width: 200,
value: 50,
increment: 10,
minValue: 0,
maxValue: 100
});</code></pre>
True while the thumb is in a drag operation
Programmatically sets the value of the Slider. Ensures that the value is constrained within
the minValue and maxValue.
The value to set the slider to. (This will be constrained within minValue and maxValue)
Turn on or off animation, defaults to true
Synchronizes the thumb position to the proper proportion of the total component width based
on the current slider <a ext:cls="apf.Slider" ext:member="value" href="output/apf.Slider.html#value">value</a>. This will be called automatically when the Slider
is resized by a layout, but if it is rendered auto width, this method can be called from
another resize handler to sync the Slider if necessary.
Returns the current value of the slider
Creates draggable splitter bar functionality from two elements (element to be dragged and element to be resized).
<br><br>
Usage:
<pre><code>var split = new apf.SplitBar("elementToDrag", "elementToSize",
apf.SplitBar.HORIZONTAL, apf.SplitBar.LEFT);
split.setAdapter(new apf.SplitBar.AbsoluteLayoutAdapter("container"));
split.minSize = 100;
split.maxSize = 600;
split.animate = true;
split.on('moved', splitterMoved);</code></pre>
Create a new SplitBar
The element to be dragged and act as the SplitBar.
The element to be resized based on where the SplitBar element is dragged
(optional) Either apf.SplitBar.HORIZONTAL or apf.SplitBar.VERTICAL. (Defaults to HORIZONTAL)
(optional) Either apf.SplitBar.LEFT or apf.SplitBar.RIGHT for horizontal or
apf.SplitBar.TOP or apf.SplitBar.BOTTOM for vertical. (By default, this is determined automatically by the initial
position of the SplitBar).
The minimum size of the resizing element. (Defaults to 0)
The maximum size of the resizing element. (Defaults to 2000)
Whether to animate the transition to the new size
Whether to create a transparent shim that overlays the page when dragging, enables dragging across iframes.
Get the adapter this SplitBar uses
Set the adapter this SplitBar uses
A SplitBar adapter object
Gets the minimum size for the resizing element
Sets the minimum size for the resizing element
The minimum size
Gets the maximum size for the resizing element
Sets the maximum size for the resizing element
The maximum size
Sets the initialize size for the resizing element
The initial size
Destroy this splitbar.
True to remove the element
Adapter that moves the splitter element to align with the resized sizing element.
Used with an absolute positioned SplitBar.
<static> Orientation constant - Create a vertical SplitBar
<static> Orientation constant - Create a horizontal SplitBar
<static> Placement constant - The resizing element is to the left of the splitter element
<static> Placement constant - The resizing element is to the right of the splitter element
<static> Placement constant - The resizing element is positioned above the splitter element
<static> Placement constant - The resizing element is positioned under splitter element
Default Adapter. It assumes the splitter and resizing element are not positioned
elements and only gets/sets the width of the element. Generally used for table based layouts.
Called before drag operations to get the current size of the resizing element.
The SplitBar using this adapter
Called after drag operations to set the size of the resizing element.
The SplitBar using this adapter
The new size to set
A function to be invoked when resizing is complete
A split button that provides a built-in dropdown arrow that can fire an event separately from the default
click event of the button. Typically this would be used to display a dropdown menu that provides additional
options to the primary button action, but any custom handler can provide the arrowclick implementation. Example usage:
<pre><code>// display a dropdown menu:
new apf.SplitButton({
renderTo: 'button-ct', // the container id
text: 'Options',
handler: optionsHandler, // handle a click on the button itself
menu: new apf.menu.Menu({
items: [
// these items will render as dropdown menu items when the arrow is clicked:
{text: 'Item 1', handler: item1Handler},
{text: 'Item 2', handler: item2Handler}
]
})
});
// Instead of showing a menu, you provide any type of custom
// functionality you want when the dropdown arrow is clicked:
new apf.SplitButton({
renderTo: 'button-ct',
text: 'Options',
handler: optionsHandler,
arrowHandler: myCustomHandler
});</code></pre>
Create a new menu button
The config object
Sets this button's arrow click handler.
The function to call when the arrow is clicked
(optional) Scope for the function passed above
<p>Basic status bar component that can be used as the bottom toolbar of any <a ext:cls="apf.Panel" href="output/apf.Panel.html">apf.Panel</a>. In addition to
supporting the standard <a ext:cls="apf.Toolbar" href="output/apf.Toolbar.html">apf.Toolbar</a> interface for adding buttons, menus and other items, the StatusBar
provides a greedy status element that can be aligned to either side and has convenient methods for setting the
status text and icon. You can also indicate that something is processing using the <a ext:cls="apf.StatusBar" ext:member="showBusy" href="output/apf.StatusBar.html#showBusy">showBusy</a> method.</p>
<p><b>Note:</b> Although StatusBar supports xtype:'statusbar', at this time apf.Toolbar (the base class) does
not support xtype. For this reason, if you are adding Toolbar items into the StatusBar you must declare it
using the "new StatusBar()" syntax for the items to render correctly.</p>
<pre><code>new apf.Panel({
title: 'StatusBar',
// etc.
bbar: new apf.StatusBar({
id: 'my-status',
// defaults to use when the status is cleared:
defaultText: 'Default status text',
defaultIconCls: 'default-icon',
// values to set initially:
text: 'Ready',
iconCls: 'ready-icon',
// any standard Toolbar items:
items: [{
text: 'A Button'
}, '-', 'Plain Text']
})
});
// Update the status bar later in code:
var sb = apf.getCmp('my-status');
sb.setStatus({
text: 'OK',
iconCls: 'ok-icon',
clear: true // auto-clear after a set interval
});
// Set the status bar to show that something is processing:
sb.showBusy();
// processing....
sb.clearStatus(); // once completeed</code></pre>
Creates a new StatusBar
A config object
Sets the status <a ext:cls="apf.StatusBar" ext:member="text" href="output/apf.StatusBar.html#text">text</a> and/or <a ext:cls="apf.StatusBar" ext:member="iconCls" href="output/apf.StatusBar.html#iconCls">iconCls</a>. Also supports automatically clearing the
status that was set after a specified interval.
A config object specifying what status to set, or a string assumed
to be the status text (and all other options are defaulted as explained below). A config
object containing any or all of the following properties can be passed:<ul>
<li><tt>text</tt> {String} : (optional) The status text to display. If not specified, any current
status text will remain unchanged.</li>
<li><tt>iconCls</tt> {String} : (optional) The CSS class used to customize the status icon (see
<a ext:cls="apf.StatusBar" ext:member="iconCls" href="output/apf.StatusBar.html#iconCls">iconCls</a> for details). If not specified, any current iconCls will remain unchanged.</li>
<li><tt>clear</tt> {Boolean/Number/Object} : (optional) Allows you to set an internal callback that will
automatically clear the status text and iconCls after a specified amount of time has passed. If clear is not
specified, the new status will not be auto-cleared and will stay until updated again or cleared using
<a ext:cls="apf.StatusBar" ext:member="clearStatus" href="output/apf.StatusBar.html#clearStatus">clearStatus</a>. If <tt>true</tt> is passed, the status will be cleared using <a ext:cls="apf.StatusBar" ext:member="autoClear" href="output/apf.StatusBar.html#autoClear">autoClear</a>,
<a ext:cls="apf.StatusBar" ext:member="defaultText" href="output/apf.StatusBar.html#defaultText">defaultText</a> and <a ext:cls="apf.StatusBar" ext:member="defaultIconCls" href="output/apf.StatusBar.html#defaultIconCls">defaultIconCls</a> via a fade out animation. If a numeric value is passed,
it will be used as the callback interval (in milliseconds), overriding the <a ext:cls="apf.StatusBar" ext:member="autoClear" href="output/apf.StatusBar.html#autoClear">autoClear</a> value.
All other options will be defaulted as with the boolean option. To customize any other options,
you can pass an object in the format:<ul>
<li><tt>wait</tt> {Number} : (optional) The number of milliseconds to wait before clearing
(defaults to <a ext:cls="apf.StatusBar" ext:member="autoClear" href="output/apf.StatusBar.html#autoClear">autoClear</a>).</li>
<li><tt>anim</tt> {Number} : (optional) False to clear the status immediately once the callback
executes (defaults to true which fades the status out).</li>
<li><tt>useDefaults</tt> {Number} : (optional) False to completely clear the status text and iconCls
(defaults to true which uses <a ext:cls="apf.StatusBar" ext:member="defaultText" href="output/apf.StatusBar.html#defaultText">defaultText</a> and <a ext:cls="apf.StatusBar" ext:member="defaultIconCls" href="output/apf.StatusBar.html#defaultIconCls">defaultIconCls</a>).</li>
</ul></li></ul>
Example usage:<pre><code>// Simple call to update the text
statusBar.setStatus('New status');
// Set the status and icon, auto-clearing with default options:
statusBar.setStatus({
text: 'New status',
iconCls: 'x-status-custom',
clear: true
});
// Auto-clear with custom options:
statusBar.setStatus({
text: 'New status',
iconCls: 'x-status-custom',
clear: {
wait: 8000,
anim: false,
useDefaults: false
}
});</code></pre>
Clears the status <a ext:cls="apf.StatusBar" ext:member="text" href="output/apf.StatusBar.html#text">text</a> and <a ext:cls="apf.StatusBar" ext:member="iconCls" href="output/apf.StatusBar.html#iconCls">iconCls</a>. Also supports clearing via an optional fade out animation.
(optional) A config object containing any or all of the following properties. If this
object is not specified the status will be cleared using the defaults below:<ul>
<li><tt>anim</tt> {Boolean} : (optional) True to clear the status by fading out the status element (defaults
to false which clears immediately).</li>
<li><tt>useDefaults</tt> {Boolean} : (optional) True to reset the text and icon using <a ext:cls="apf.StatusBar" ext:member="defaultText" href="output/apf.StatusBar.html#defaultText">defaultText</a> and
<a ext:cls="apf.StatusBar" ext:member="defaultIconCls" href="output/apf.StatusBar.html#defaultIconCls">defaultIconCls</a> (defaults to false which sets the text to '' and removes any existing icon class).</li>
</ul>
Convenience method for setting the status text directly. For more flexible options see <a ext:cls="apf.StatusBar" ext:member="setStatus" href="output/apf.StatusBar.html#setStatus">setStatus</a>.
(optional) The text to set (defaults to '')
Returns the current status text.
Convenience method for setting the status icon directly. For more flexible options see <a ext:cls="apf.StatusBar" ext:member="setStatus" href="output/apf.StatusBar.html#setStatus">setStatus</a>.
See <a ext:cls="apf.StatusBar" ext:member="iconCls" href="output/apf.StatusBar.html#iconCls">iconCls</a> for complete details about customizing the icon.
(optional) The icon class to set (defaults to '', and any current icon class is removed)
Convenience method for setting the status text and icon to special values that are pre-configured to indicate
a "busy" state, usually for loading or processing activities.
(optional) A config object in the same format supported by <a ext:cls="apf.StatusBar" ext:member="setStatus" href="output/apf.StatusBar.html#setStatus">setStatus</a>, or a
string to use as the status text (in which case all other options for setStatus will be defaulted). Use the
<tt>text</tt> and/or <tt>iconCls</tt> properties on the config to override the default <a ext:cls="apf.StatusBar" ext:member="busyText" href="output/apf.StatusBar.html#busyText">busyText</a>
and <a ext:cls="apf.StatusBar" ext:member="busyIconCls" href="output/apf.StatusBar.html#busyIconCls">busyIconCls</a> settings. If the config argument is not specified, <a ext:cls="apf.StatusBar" ext:member="busyText" href="output/apf.StatusBar.html#busyText">busyText</a> and
<a ext:cls="apf.StatusBar" ext:member="busyIconCls" href="output/apf.StatusBar.html#busyIconCls">busyIconCls</a> will be used in conjunction with all of the default options for <a ext:cls="apf.StatusBar" ext:member="setStatus" href="output/apf.StatusBar.html#setStatus">setStatus</a>.
The default global group of stores.<br><br><i>This class is a singleton and cannot be created directly.</i>
Registers one or more Stores with the StoreMgr. You do not normally need to register stores
manually. Any store initialized with a <a ext:cls="apf.data.Store" ext:member="storeId" href="output/apf.data.Store.html#storeId">apf.data.Store.storeId</a> will be auto-registered.
A Store instance
(optional)
(optional)
Unregisters one or more Stores with the StoreMgr
The id of the Store, or a Store instance
(optional)
(optional)
Gets a registered Store by id
The id of the Store, or a Store instance
<p>A basic tab container. TabPanels can be used exactly like a standard <a ext:cls="apf.Panel" href="output/apf.Panel.html">apf.Panel</a> for layout
purposes, but also have special support for containing child Components that are managed using a CardLayout
layout manager, and displayed as seperate tabs.</p>
<p>There is no actual tab class — each tab is simply an <a ext:cls="apf.BoxComponent" href="output/apf.BoxComponent.html">Component</a> such
as a <a ext:cls="apf.Panel" href="output/apf.Panel.html">Panel</a>. However, when rendered in a TabPanel, each child Component can fire
additional events that only exist for tabs and are not available from other Component. These are:</p>
<ul>
<li><b>activate</b>: Fires when this Component becomes the active tab.
<div class="mdetail-params">
<strong style="font-weight: normal;">Listeners will be called with the following arguments:</strong>
<ul><li><code>tab</code> : Panel<div class="sub-desc">The tab that was activated</div></li></ul>
</div></li>
<li><b>deactivate</b>: Fires when the Component that was the active tab becomes deactivated.
<div class="mdetail-params">
<strong style="font-weight: normal;">Listeners will be called with the following arguments:</strong>
<ul><li><code>tab</code> : Panel<div class="sub-desc">The tab that was deactivated</div></li></ul>
</div></li>
</ul>
<p>To add Components to a TabPanel which are generated dynamically on the server, it is necessary to
create a server script to generate the Javascript to create the Component required.</p>
For example, to add a GridPanel to a TabPanel where the GridPanel is generated by the server
based on certain parameters, you would need to execute an Ajax request to invoke your the script,
and process the response object to add it to the TabPanel:</p><pre><code>apf.Ajax.request({
url: 'gen-invoice-grid.php',
params: {
startDate = apf.getCmp('start-date').getValue(),
endDate = apf.getCmp('end-date').getValue()
},
success: function(xhr) {
var newComponent = eval(xhr.responseText);
myTabPanel.add(newComponent);
myTabPanel.setActiveTab(newComponent);
},
failure: function() {
apf.Msg.alert("Grid create failed", "Server communication failure");
}
});</code></pre>
<p>The server script would need to return an executable Javascript statement which, when processed
using <tt>eval()</tt> will return either a config object with an <a ext:cls="apf.Component" ext:member="xtype" href="output/apf.Component.html#xtype">xtype</a>,
or an instantiated Component. For example:</p><pre><code>{function() {
function formatDate(value){
return value ? value.dateFormat('M d, Y') : '';
};
var store = new apf.data.Store({
url: 'get-invoice-data.php',
baseParams: {
startDate: '01/01/2008',
endDate: '01/31/2008'
}
reader: new apf.data.JsonReader({
record: 'transaction',
id: 'id',
totalRecords: 'total'
}, [
'customer',
'invNo',
{name: 'date', type: 'date', dateFormat: 'm/d/Y'},
{name: 'value', type: 'float'}
])
});
var grid = new apf.grid.GridPanel({
title: 'Invoice Report',
bbar: new apf.PagingToolbar(store),
store: store,
columns: [
{header: "Customer", width: 250, dataIndex: 'customer', sortable: true},
{header: "Invoice Number", width: 120, dataIndex: 'invNo', sortable: true},
{header: "Invoice Date", width: 100, dataIndex: 'date', renderer: formatDate, sortable: true},
{header: "Value", width: 120, dataIndex: 'value', renderer: 'usMoney', sortable: true}
],
});
store.load();
return grid;
})();</code></pre>
<p>Since that code is <i>generated</i> by a server script, the <tt>baseParams</tt> for the Store
can be configured into the Store. The metadata to allow generation of the Record layout, and the
ColumnModel is also known on the server, so these can be generated into the code.</p>
<p>When that code fragment is passed through the <tt>eval</tt> function in the success handler
of the Ajax request, the code is executed by the Javascript processor, and the anonymous function
runs, and returns the grid.</p>
<p>There are several other methods available for creating TabPanels. The output of the following
examples should produce exactly the same appearance. The tabs can be created and rendered completely
in code, as in this example:</p>
<pre><code>var tabs = new apf.TabPanel({
renderTo: apf.getBody(),
activeTab: 0,
items: [{
title: 'Tab 1',
html: 'A simple tab'
},{
title: 'Tab 2',
html: 'Another one'
}]
});</code></pre>
<p>TabPanels can also be rendered from pre-existing markup in a couple of ways. See the <a ext:cls="apf.TabPanel" ext:member="autoTabs" href="output/apf.TabPanel.html#autoTabs">autoTabs</a> example for
rendering entirely from markup that is already structured correctly as a TabPanel (a container div with
one or more nested tab divs with class 'x-tab'). You can also render from markup that is not strictly
structured by simply specifying by id which elements should be the container and the tabs. Using this method,
tab content can be pulled from different elements within the page by id regardless of page structure. Note
that the tab divs in this example contain the class 'x-hide-display' so that they can be rendered deferred
without displaying outside the tabs. You could alternately set <a ext:cls="apf.TabPanel" ext:member="deferredRender" href="output/apf.TabPanel.html#deferredRender">deferredRender</a> to false to render all
content tabs on page load. For example:
<pre><code>var tabs = new apf.TabPanel({
renderTo: 'my-tabs',
activeTab: 0,
items:[
{contentEl:'tab1', title:'Tab 1'},
{contentEl:'tab2', title:'Tab 2'}
]
});
// Note that the tabs do not have to be nested within the container (although they can be)
<div id="my-tabs"></div>
<div id="tab1" class="x-hide-display">A simple tab</div>
<div id="tab2" class="x-hide-display">Another one</div></code></pre>
The configuration options
@hide
@hide
True to scan the markup in this tab panel for autoTabs using the autoTabSelector
True to remove existing tabs
Gets the DOM element for tab strip item which activates the
child panel with the specified ID. Access this to change the visual treatment of the
item, for example by changing the CSS class name.
The tab
Suspends any internal calculations or scrolling while doing a bulk operation. See <a ext:cls="apf.TabPanel" ext:member="endUpdate" href="output/apf.TabPanel.html#endUpdate">endUpdate</a>
Resumes calculations and scrolling at the end of a bulk operation. See <a ext:cls="apf.TabPanel" ext:member="beginUpdate" href="output/apf.TabPanel.html#beginUpdate">beginUpdate</a>
Hides the tab strip item for the passed tab
The tab index, id or item
Unhides the tab strip item for the passed tab
The tab index, id or item
Sets the specified tab as the active tab. This method fires the <a ext:cls="apf.TabPanel" ext:member="beforetabchange" href="output/apf.TabPanel.html#beforetabchange">beforetabchange</a> event which
can return false to cancel the tab change.
The id or tab Panel to activate
Gets the currently active tab.
Gets the specified tab by id.
The tab id
Scrolls to a particular tab if tab scrolling is enabled
The item to scroll to
True to enable animations
Sets the specified tab as the active tab. This method fires the <a ext:cls="apf.TabPanel" ext:member="beforetabchange" href="output/apf.TabPanel.html#beforetabchange">beforetabchange</a> event which
can return false to cancel the tab change.
The id or tab Panel to activate
A static <a ext:cls="apf.util.TaskRunner" href="output/apf.util.TaskRunner.html">apf.util.TaskRunner</a> instance that can be used to start and stop arbitrary tasks. See
<a ext:cls="apf.util.TaskRunner" href="output/apf.util.TaskRunner.html">apf.util.TaskRunner</a> for supported methods and task config properties.
<pre><code>// Start a simple clock task that updates a div once per second
var task = {
run: function(){
apf.fly('clock').update(new Date().format('g:i:s A'));
},
interval: 1000 //1 second
}
apf.TaskMgr.start(task);</code></pre><br><br><i>This class is a singleton and cannot be created directly.</i>
Represents an HTML fragment template. Templates can be precompiled for greater performance.
For a list of available format functions, see <a ext:cls="apf.util.Format" href="output/apf.util.Format.html">apf.util.Format</a>.<br />
Usage:
<pre><code>var t = new apf.Template(
'<div name="{id}">',
'<span class="{cls}">{name:trim} {value:ellipsis(10)}</span>',
'</div>'
);
t.append('some-element', {id: 'myid', cls: 'myclass', name: 'foo', value: 'bar'});</code></pre>
For more information see this blog post with examples: <a href="http://www.jackslocum.com/blog/2006/10/06/domhelper-create-elements-using-dom-html-fragments-or-templates/">DomHelper - Create Elements using DOM, HTML fragments and Templates</a>.
The HTML fragment or an array of fragments to join("") or multiple arguments to join("")
True to disable format functions (defaults to false)
The regular expression used to match template variables
Returns an HTML fragment of this template with the specified values applied.
The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})
Sets the HTML used as the template and optionally compiles it.
(optional) True to compile the template (defaults to undefined)
Compiles the template into an internal function, eliminating the RegEx overhead.
Applies the supplied values to the template and inserts the new node(s) as the first child of el.
The context element
The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})
(optional) true to return a apf.Element (defaults to undefined)
Applies the supplied values to the template and inserts the new node(s) before el.
The context element
The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})
(optional) true to return a apf.Element (defaults to undefined)
Applies the supplied values to the template and inserts the new node(s) after el.
The context element
The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})
(optional) true to return a apf.Element (defaults to undefined)
Applies the supplied values to the template and appends the new node(s) to el.
The context element
The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})
(optional) true to return a apf.Element (defaults to undefined)
Applies the supplied values to the template and overwrites the content of el with the new node(s).
The context element
The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})
(optional) true to return a apf.Element (defaults to undefined)
<static> Creates a template from the passed element's value (<i>display:none</i> textarea, preferred) or innerHTML.
A DOM element or its id
A configuration object
Alias for <a ext:cls="apf.Template" ext:member="applyTemplate" href="output/apf.Template.html#applyTemplate">applyTemplate</a>
Returns an HTML fragment of this template with the specified values applied.
The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})
This is the base class for <a ext:cls="apf.QuickTip" href="output/apf.QuickTip.html">apf.QuickTip</a> and <a ext:cls="apf.Tooltip" href="output/apf.Tooltip.html">apf.Tooltip</a> that provides the basic layout and
positioning that all tip-based classes require. This class can be used directly for simple, statically-positioned
tips that are displayed programmatically, or it can be extended to provide custom tip implementations.
Create a new Tip
The configuration options
Shows this tip at the specified XY position. Example usage:
<pre><code>// Show the tip at x:50 and y:100
tip.showAt([50,100]);</code></pre>
An array containing the x and y coordinates
<b>Experimental</b>. Shows this tip at a position relative to another element using a standard <a ext:cls="apf.Element" ext:member="alignTo" href="output/apf.Element.html#alignTo">apf.Element.alignTo</a>
anchor position value. Example usage:
<pre><code>// Show the tip at the default position ('tl-br?')
tip.showBy('my-el');
// Show the tip's top-left corner anchored to the element's top-right corner
tip.showBy('my-el', 'tl-tr');</code></pre>
An HTMLElement, apf.Element or string id of the target element to align to
(optional) A valid <a ext:cls="apf.Element" ext:member="alignTo" href="output/apf.Element.html#alignTo">apf.Element.alignTo</a> anchor position (defaults to 'tl-br?' or
<a ext:cls="apf.Tip" ext:member="defaultAlign" href="output/apf.Tip.html#defaultAlign">defaultAlign</a> if specified).
A standard tooltip implementation for providing additional information when hovering over a target element.
Create a new Tooltip
The configuration options
Hides this tooltip if visible.
Shows this tooltip at the current event target XY position.
Basic Toolbar class. Toolbar elements can be created explicitly via their constructors, or implicitly
via their xtypes. Some items also have shortcut strings for creation.
Creates a new Toolbar
A config object or an array of buttons to add
A MixedCollection of this Toolbar's items
Adds element(s) to the toolbar -- this function takes a variable number of
arguments of mixed type and adds them to the toolbar.
The following types of arguments are all valid:<br />
<ul>
<li><a ext:cls="apf.Toolbar.Button" href="output/apf.Toolbar.Button.html">apf.Toolbar.Button</a> config: A valid button config object (equivalent to <a ext:cls="apf.Toolbar" ext:member="addButton" href="output/apf.Toolbar.html#addButton">addButton</a>)</li>
<li>HtmlElement: Any standard HTML element (equivalent to <a ext:cls="apf.Toolbar" ext:member="addElement" href="output/apf.Toolbar.html#addElement">addElement</a>)</li>
<li>Field: Any form field (equivalent to <a ext:cls="apf.Toolbar" ext:member="addField" href="output/apf.Toolbar.html#addField">addField</a>)</li>
<li>Item: Any subclass of <a ext:cls="apf.Toolbar.Item" href="output/apf.Toolbar.Item.html">apf.Toolbar.Item</a> (equivalent to <a ext:cls="apf.Toolbar" ext:member="addItem" href="output/apf.Toolbar.html#addItem">addItem</a>)</li>
<li>String: Any generic string (gets wrapped in a <a ext:cls="apf.Toolbar.TextItem" href="output/apf.Toolbar.TextItem.html">apf.Toolbar.TextItem</a>, equivalent to <a ext:cls="apf.Toolbar" ext:member="addText" href="output/apf.Toolbar.html#addText">addText</a>).
Note that there are a few special strings that are treated differently as explained next.</li>
<li>'separator' or '-': Creates a separator element (equivalent to <a ext:cls="apf.Toolbar" ext:member="addSeparator" href="output/apf.Toolbar.html#addSeparator">addSeparator</a>)</li>
<li>' ': Creates a spacer element (equivalent to <a ext:cls="apf.Toolbar" ext:member="addSpacer" href="output/apf.Toolbar.html#addSpacer">addSpacer</a>)</li>
<li>'->': Creates a fill element (equivalent to <a ext:cls="apf.Toolbar" ext:member="addFill" href="output/apf.Toolbar.html#addFill">addFill</a>)</li>
</ul>
Adds a separator
Adds a spacer element
Adds a fill element that forces subsequent additions to the right side of the toolbar
Adds any standard HTML element to the toolbar
The element or id of the element to add
Adds any Toolbar.Item or subclass
Adds a button (or buttons). See <a ext:cls="apf.Toolbar.Button" href="output/apf.Toolbar.Button.html">apf.Toolbar.Button</a> for more info on the config.
A button config or array of configs
Adds text to the toolbar
The text to add
Inserts any <a ext:cls="apf.Toolbar.Item" href="output/apf.Toolbar.Item.html">apf.Toolbar.Item</a>/<a ext:cls="apf.Toolbar.Button" href="output/apf.Toolbar.Button.html">apf.Toolbar.Button</a> at the specified index.
The index where the item is to be inserted
The button, or button config object to be
inserted, or an array of buttons/configs.
Adds a new element to the toolbar from the passed <a ext:cls="apf.DomHelper" href="output/apf.DomHelper.html">apf.DomHelper</a> config
Adds a dynamically rendered apf.form field (TextField, ComboBox, etc). Note: the field should not have
been rendered yet. For a field that has already been rendered, use <a ext:cls="apf.Toolbar" ext:member="addElement" href="output/apf.Toolbar.html#addElement">addElement</a>.
A button that renders into a toolbar. Use the <tt>handler</tt> config to specify a callback function
to handle the button's click event.
<pre><code>new apf.Panel({
tbar : [
{text: 'OK', handler: okHandler} // tbbutton is the default xtype if not specified
]
});</code></pre>
Creates a new Button
A standard <a ext:cls="apf.Button" href="output/apf.Button.html">apf.Button</a> config object
A simple element that adds a greedy (100% width) horizontal space between items in a toolbar.
<pre><code>new apf.Panel({
tbar : [
'Item 1',
{xtype: 'tbfill'}, // or '->'
'Item 2'
]
});</code></pre>
Creates a new Spacer
The base class that other classes should extend in order to get some basic common toolbar item functionality.
Creates a new Item
Get this item's HTML Element
Removes and destroys this item.
Shows this item.
Hides this item.
Convenience function for boolean show/hide.
true to show/false to hide
Try to focus this item
Disables this item.
Enables this item.
A simple class that adds a vertical separator bar between toolbar items. Example usage:
<pre><code>new apf.Panel({
tbar : [
'Item 1',
{xtype: 'tbseparator'}, // or '-'
'Item 2'
]
});</code></pre>
Creates a new Separator
A simple element that adds extra horizontal space between items in a toolbar.
<pre><code>new apf.Panel({
tbar : [
'Item 1',
{xtype: 'tbspacer'}, // or ' '
'Item 2'
]
});</code></pre>
Creates a new Spacer
A split button that renders into a toolbar.
<pre><code>new apf.Panel({
tbar : [
{
xtype: 'tbsplit',
text: 'Options',
handler: optionsHandler, // handle a click on the button itself
menu: new apf.menu.Menu({
items: [
// These items will display in a dropdown menu when the split arrow is clicked
{text: 'Item 1', handler: item1Handler},
{text: 'Item 2', handler: item2Handler}
]
})
}
]
});</code></pre>
Creates a new SplitButton
A standard <a ext:cls="apf.SplitButton" href="output/apf.SplitButton.html">apf.SplitButton</a> config object
A simple class that renders text directly into a toolbar.
<pre><code>new apf.Panel({
tbar : [
{xtype: 'tbtext', text: 'Item 1'} // or simply 'Item 1'
]
});</code></pre>
Creates a new TextItem
A text string, or a config object containing a <tt>text</tt> property
Provides AJAX-style update capabilities for Element objects. Updater can be used to <a ext:cls="apf.Updater" ext:member="update" href="output/apf.Updater.html#update">update</a> an Element once,
or you can use <a ext:cls="apf.Updater" ext:member="startAutoRefresh" href="output/apf.Updater.html#startAutoRefresh">startAutoRefresh</a> to set up an auto-updating Element on a specific interval.<br><br>
Usage:<br>
<pre><code>// Get it from a apf.Element object
var el = apf.get("foo");
var mgr = el.getUpdater();
mgr.update({
url: "http://myserver.com/index.php",
params: {
param1: "foo",
param2: "bar"
}
});
...
mgr.formUpdate("myFormId", "http://myserver.com/index.php");
<br>
// or directly (returns the same Updater instance)
var mgr = new apf.Updater("myElementId");
mgr.startAutoRefresh(60, "http://myserver.com/index.php");
mgr.on("update", myFcnNeedsToKnow);
<br>
// short handed call directly from the element object
apf.get("foo").load({
url: "bar.php",
scripts: true,
params: "param1=foo&param2=bar",
text: "Loading Foo..."
});</code></pre>
Create new Updater directly.
The element to update
(optional) By default the constructor checks to see if the passed element already
has an Updater and if it does it returns the same instance. This will skip that check (useful for extending this class).
The Element object
Cached url to use for refreshes. Overwritten every time update() is called unless "discardUrl" param is set to true.
Blank page URL to use with SSL file uploads (defaults to <a ext:cls="apf.Updater.defaults" ext:member="sslBlankUrl" href="output/apf.Updater.defaults.html#sslBlankUrl">apf.Updater.defaults.sslBlankUrl</a>).
Whether to append unique parameter on get request to disable caching (defaults to <a ext:cls="apf.Updater.defaults" ext:member="disableCaching" href="output/apf.Updater.defaults.html#disableCaching">apf.Updater.defaults.disableCaching</a>).
Text for loading indicator (defaults to <a ext:cls="apf.Updater.defaults" ext:member="indicatorText" href="output/apf.Updater.defaults.html#indicatorText">apf.Updater.defaults.indicatorText</a>).
Whether to show indicatorText when loading (defaults to <a ext:cls="apf.Updater.defaults" ext:member="showLoadIndicator" href="output/apf.Updater.defaults.html#showLoadIndicator">apf.Updater.defaults.showLoadIndicator</a>).
Timeout for requests or form posts in seconds (defaults to <a ext:cls="apf.Updater.defaults" ext:member="timeout" href="output/apf.Updater.defaults.html#timeout">apf.Updater.defaults.timeout</a>).
True to process scripts in the output (defaults to <a ext:cls="apf.Updater.defaults" ext:member="loadScripts" href="output/apf.Updater.defaults.html#loadScripts">apf.Updater.defaults.loadScripts</a>).
Transaction object of the current executing transaction, or null if there is no active transaction.
Delegate for refresh() prebound to "this", use myUpdater.refreshDelegate.createCallback(arg1, arg2) to bind arguments
Delegate for update() prebound to "this", use myUpdater.updateDelegate.createCallback(arg1, arg2) to bind arguments
Delegate for formUpdate() prebound to "this", use myUpdater.formUpdateDelegate.createCallback(arg1, arg2) to bind arguments
The renderer for this Updater (defaults to <a ext:cls="apf.Updater.BasicRenderer" href="output/apf.Updater.BasicRenderer.html">apf.Updater.BasicRenderer</a>).
This is an overrideable method which returns a reference to a default
renderer class if none is specified when creating the apf.Updater.
Defaults to <a ext:cls="apf.Updater.BasicRenderer" href="output/apf.Updater.BasicRenderer.html">apf.Updater.BasicRenderer</a>
Get the Element this Updater is bound to
Performs an <b>asynchronous</b> request, updating this element with the response.
If params are specified it uses POST, otherwise it uses GET.<br><br>
<b>Note:</b> Due to the asynchronous nature of remote server requests, the Element
will not have been fully updated when the function returns. To post-process the returned
data, use the callback option, or an <b><tt>update</tt></b> event handler.
A config object containing any of the following options:<ul>
<li>url : <b>String/Function</b><p class="sub-desc">The URL to request or a function which
<i>returns</i> the URL (defaults to the value of <a ext:cls="apf.Ajax" ext:member="url" href="output/apf.Ajax.html#url">apf.Ajax.url</a> if not specified).</p></li>
<li>method : <b>String</b><p class="sub-desc">The HTTP method to
use. Defaults to POST if the <tt>params</tt> argument is present, otherwise GET.</p></li>
<li>params : <b>String/Object/Function</b><p class="sub-desc">The
parameters to pass to the server (defaults to none). These may be specified as a url-encoded
string, or as an object containing properties which represent parameters,
or as a function, which returns such an object.</p></li>
<li>scripts : <b>Boolean</b><p class="sub-desc">If <tt>true</tt>
any <script> tags embedded in the response text will be extracted
and executed (defaults to <a ext:cls="apf.Updater.defaults" ext:member="loadScripts" href="output/apf.Updater.defaults.html#loadScripts">apf.Updater.defaults.loadScripts</a>). If this option is specified,
the callback will be called <i>after</i> the execution of the scripts.</p></li>
<li>callback : <b>Function</b><p class="sub-desc">A function to
be called when the response from the server arrives. The following
parameters are passed:<ul>
<li><b>el</b> : apf.Element<p class="sub-desc">The Element being updated.</p></li>
<li><b>success</b> : Boolean<p class="sub-desc">True for success, false for failure.</p></li>
<li><b>response</b> : XMLHttpRequest<p class="sub-desc">The XMLHttpRequest which processed the update.</p></li>
<li><b>options</b> : Object<p class="sub-desc">The config object passed to the update call.</p></li></ul>
</p></li>
<li>scope : <b>Object</b><p class="sub-desc">The scope in which
to execute the callback (The callback's <tt>this</tt> reference.) If the
<tt>params</tt> argument is a function, this scope is used for that function also.</p></li>
<li>discardUrl : <b>Boolean</b><p class="sub-desc">By default, the URL of this request becomes
the default URL for this Updater object, and will be subsequently used in <a ext:cls="apf.Updater" ext:member="refresh" href="output/apf.Updater.html#refresh">refresh</a>
calls. To bypass this behavior, pass <tt>discardUrl:true</tt> (defaults to false).</p></li>
<li>timeout : <b>Number</b><p class="sub-desc">The number of seconds to wait for a response before
timing out (defaults to <a ext:cls="apf.Updater.defaults" ext:member="timeout" href="output/apf.Updater.defaults.html#timeout">apf.Updater.defaults.timeout</a>).</p></li>
<li>text : <b>String</b><p class="sub-desc">The text to use as the innerHTML of the
<a ext:cls="apf.Updater.defaults" ext:member="indicatorText" href="output/apf.Updater.defaults.html#indicatorText">apf.Updater.defaults.indicatorText</a> div (defaults to 'Loading...'). To replace the entire div, not
just the text, override <a ext:cls="apf.Updater.defaults" ext:member="indicatorText" href="output/apf.Updater.defaults.html#indicatorText">apf.Updater.defaults.indicatorText</a> directly.</p></li>
<li>nocache : <b>Boolean</b><p class="sub-desc">Only needed for GET
requests, this option causes an extra, auto-generated parameter to be appended to the request
to defeat caching (defaults to <a ext:cls="apf.Updater.defaults" ext:member="disableCaching" href="output/apf.Updater.defaults.html#disableCaching">apf.Updater.defaults.disableCaching</a>).</p></li></ul>
<p>
For example:
<pre><code>um.update({
url: "your-url.php",
params: {param1: "foo", param2: "bar"}, // or a URL encoded string
callback: yourFunction,
scope: yourObject, //(optional scope)
discardUrl: true,
nocache: true,
text: "Loading...",
timeout: 60,
scripts: false // Save time by avoiding RegExp execution.
});</code></pre>
Performs an async form post, updating this element with the response. If the form has the attribute
enctype="multipart/form-data", it assumes it's a file upload.
Uses this.sslBlankUrl for SSL file uploads to prevent IE security warning.
The form Id or form element
(optional) The url to pass the form to. If omitted the action attribute on the form will be used.
(optional) Whether to try to reset the form after the update
(optional) Callback when transaction is complete. The following
parameters are passed:<ul>
<li><b>el</b> : apf.Element<p class="sub-desc">The Element being updated.</p></li>
<li><b>success</b> : Boolean<p class="sub-desc">True for success, false for failure.</p></li>
<li><b>response</b> : XMLHttpRequest<p class="sub-desc">The XMLHttpRequest which processed the update.</p></li></ul>
Refresh the element with the last used url or defaultUrl. If there is no url, it returns immediately
(optional) Callback when transaction is complete - called with signature (oElement, bSuccess)
Set this element to auto refresh. Can be canceled by calling <a ext:cls="apf.Updater" ext:member="stopAutoRefresh" href="output/apf.Updater.html#stopAutoRefresh">stopAutoRefresh</a>.
How often to update (in seconds).
(optional) The url for this request, a config object in the same format
supported by <a ext:cls="apf.Updater" ext:member="load" href="output/apf.Updater.html#load">load</a>, or a function to call to get the url (defaults to the last used url). Note that while
the url used in a load call can be reused by this method, other load config options will not be reused and must be
sepcified as part of a config object passed as this paramter if needed.
(optional) The parameters to pass as either a url encoded string
"¶m1=1¶m2=2" or as an object {param1: 1, param2: 2}
(optional) Callback when transaction is complete - called with signature (oElement, bSuccess)
(optional) Whether to execute the refresh now, or wait the interval
Stop auto refresh on this element.
Returns true if the Updater is currently set to auto refresh its content (see <a ext:cls="apf.Updater" ext:member="startAutoRefresh" href="output/apf.Updater.html#startAutoRefresh">startAutoRefresh</a>), otherwise false.
Display the element's "loading" state. By default, the element is updated with <a ext:cls="apf.Updater" ext:member="indicatorText" href="output/apf.Updater.html#indicatorText">indicatorText</a>. This
method may be overridden to perform a custom action while this Updater is actively updating its contents.
Sets the content renderer for this Updater. See <a ext:cls="apf.Updater.BasicRenderer" ext:member="render" href="output/apf.Updater.BasicRenderer.html#render">apf.Updater.BasicRenderer.render</a> for more details.
The object implementing the render() method
Returns the content renderer for this Updater. See <a ext:cls="apf.Updater.BasicRenderer" ext:member="render" href="output/apf.Updater.BasicRenderer.html#render">apf.Updater.BasicRenderer.render</a> for more details.
Sets the default URL used for updates.
The url or a function to call to get the url
Aborts the currently executing transaction, if any.
Returns true if an update is in progress, otherwise false.
<b>Deprecated.</b> <static> Static convenience method. <b>This method is deprecated in favor of el.load({url:'foo.php', ...})</b>.
Usage:
<pre><code>apf.Updater.updateElement("my-div", "stuff.php");</code></pre>
The element to update
The url
(optional) Url encoded param string or an object of name/value pairs
(optional) A config object with any of the Updater properties you want to set - for
example: {disableCaching:true, indicatorText: "Loading data..."}
Default Content renderer. Updates the elements innerHTML with the responseText.
This is called when the transaction is completed and it's time to update the element - The BasicRenderer
updates the elements innerHTML with the responseText - To perform a custom render (i.e. XML or JSON processing),
create an object with a "render(el, response)" method and pass it to setRenderer on the Updater.
The element being rendered
The XMLHttpRequest object
The calling update manager
A callback that will need to be called if loadScripts is true on the Updater
The defaults collection enables customizing the default properties of Updater
Timeout for requests or form posts in seconds (defaults to 30 seconds).
True to process scripts by default (defaults to false).
Blank page URL to use with SSL file uploads (defaults to <a ext:cls="apf" ext:member="SSL_SECURE_URL" href="output/apf.html#SSL_SECURE_URL">apf.SSL_SECURE_URL</a> if set, or "javascript:false").
True to append a unique parameter to GET requests to disable caching (defaults to false).
Whether or not to show <a ext:cls="apf.Updater.defaults" ext:member="indicatorText" href="output/apf.Updater.defaults.html#indicatorText">indicatorText</a> during loading (defaults to true).
Text for loading indicator (defaults to '<div class="loading-indicator">Loading...</div>').
A specialized container representing the viewable application area (the browser viewport).
<p> The Viewport renders itself to the document body, and automatically sizes itself to the size of
the browser viewport and manages window resizing. There may only be one Viewport created
in a page. Inner layouts are available by virtue of the fact that all <a ext:cls="apf.Panel" href="output/apf.Panel.html">Panel</a>s
added to the Viewport, either through its <a ext:cls="apf.Viewport" ext:member="items" href="output/apf.Viewport.html#items">items</a>, or through the items, or the <a ext:cls="apf.Viewport" ext:member="add" href="output/apf.Viewport.html#add">add</a>
method of any of its child Panels may themselves have a layout.</p>
<p>The Viewport does not provide scrolling, so child Panels within the Viewport should provide
for scrolling if needed using the <a ext:cls="apf.Viewport" ext:member="autoScroll" href="output/apf.Viewport.html#autoScroll">autoScroll</a> config.</p>
Example showing a classic application border layout :<pre><code>new apf.Viewport({
layout: 'border',
items: [{
region: 'north',
html: '<h1 class="x-panel-header">Page Title</h1>',
autoHeight: true,
border: false,
margins: '0 0 5 0'
}, {
region: 'west',
collapsible: true,
title: 'Navigation',
xtype: 'treepanel',
width: 200,
autoScroll: true,
split: true,
loader: new apf.tree.TreeLoader(),
root: new apf.tree.AsyncTreeNode({
expanded: true,
children: [{
text: 'Menu Option 1',
leaf: true
}, {
text: 'Menu Option 2',
leaf: true
}, {
text: 'Menu Option 3',
leaf: true
}]
}),
rootVisible: false,
listeners: {
click: function(n) {
apf.Msg.alert('Navigation Tree Click', 'You clicked: "' + n.attributes.text + '"');
}
}
}, {
region: 'center',
xtype: 'tabpanel',
items: {
title: 'Default Tab',
html: 'The first tab\'s content. Others may be added dynamically'
}
}, {
region: 'south',
title: 'Information',
collapsible: true,
html: 'Information goes here',
split: true,
height: 100,
minHeight: 100
}]
});</code></pre>
Create a new Viewport
The config object
A specialized panel intended for use as an application window. Windows are floated and draggable by default, and
also provide specific behavior like the ability to maximize and restore (with an event for minimizing, since the
minimize behavior is application-specific). Windows can also be linked to a <a ext:cls="apf.WindowGroup" href="output/apf.WindowGroup.html">apf.WindowGroup</a> or managed
by the <a ext:cls="apf.WindowManager" href="output/apf.WindowManager.html">apf.WindowManager</a> to provide grouping, activation, to front/back and other application-specific behavior.
The config object
If this Window is configured <a ext:cls="apf.Window" ext:member="draggable" href="output/apf.Window.html#draggable">draggable</a>, this property will contain
an instance of <a ext:cls="apf.dd.DD" href="output/apf.dd.DD.html">apf.dd.DD</a> which handles dragging the Window's DOM Element.
Focuses the window. If a defaultButton is set, it will receive focus, otherwise the
window itself will receive focus.
Sets the target element from which the window should animate while opening.
The target element or id
Shows the window, rendering it first if necessary, or activates it and brings it to front if hidden.
(optional) The target element or id from which the window should
animate while opening (defaults to undefined with no animation)
(optional) A callback function to call after the window is displayed
(optional) The scope in which to execute the callback
Hides the window, setting it to invisible and applying negative offsets.
(optional) The target element or id to which the window should
animate while hiding (defaults to null with no animation)
(optional) A callback function to call after the window is hidden
(optional) The scope in which to execute the callback
Placeholder method for minimizing the window. By default, this method simply fires the <a ext:cls="apf.Window" ext:member="minimize" href="output/apf.Window.html#minimize">minimize</a> event
since the behavior of minimizing a window is application-specific. To implement custom minimize behavior,
either the minimize event can be handled or this method can be overridden.
Closes the window, removes it from the DOM and destroys the window object. The beforeclose event is fired
before the close happens and will cancel the close action if it returns false.
Fits the window within its current container and automatically replaces the 'maximize' tool button with
the 'restore' tool button.
Restores a maximized window back to its original size and position prior to being maximized and also replaces
the 'restore' tool button with the 'maximize' tool button.
A shortcut method for toggling between <a ext:cls="apf.Window" ext:member="maximize" href="output/apf.Window.html#maximize">maximize</a> and <a ext:cls="apf.Window" ext:member="restore" href="output/apf.Window.html#restore">restore</a> based on the current maximized
state of the window.
Aligns the window to the specified element
The element to align to.
The position to align to (see <a ext:cls="apf.Element" ext:member="alignTo" href="output/apf.Element.html#alignTo">apf.Element.alignTo</a> for more details).
(optional) Offset the positioning by [x, y]
Anchors this window to another element and realigns it when the window is resized or scrolled.
The element to align to.
The position to align to (see <a ext:cls="apf.Element" ext:member="alignTo" href="output/apf.Element.html#alignTo">apf.Element.alignTo</a> for more details)
(optional) Offset the positioning by [x, y]
(optional) true to monitor body scroll and reposition. If this parameter
is a number, it is used as the buffer delay (defaults to 50ms).
Brings this window to the front of any other visible windows
Makes this the active window by showing its shadow, or deactivates it by hiding its shadow. This method also
fires the <a ext:cls="apf.Window" ext:member="activate" href="output/apf.Window.html#activate">activate</a> or <a ext:cls="apf.Window" ext:member="deactivate" href="output/apf.Window.html#deactivate">deactivate</a> event depending on which action occurred.
True to activate the window, false to deactivate it (defaults to false)
Sends this window to the back of (lower z-index than) any other visible windows
Centers this window in the viewport
An object that represents a group of <a ext:cls="apf.Window" href="output/apf.Window.html">apf.Window</a> instances and provides z-order management
and window activation behavior.
The starting z-index for windows (defaults to 9000)
Gets a registered window by id.
The id of the window or a <a ext:cls="apf.Window" href="output/apf.Window.html">apf.Window</a> instance
Brings the specified window to the front of any other active windows.
The id of the window or a <a ext:cls="apf.Window" href="output/apf.Window.html">apf.Window</a> instance
Sends the specified window to the back of other active windows.
The id of the window or a <a ext:cls="apf.Window" href="output/apf.Window.html">apf.Window</a> instance
Hides all windows in the group.
Gets the currently-active window in the group.
Returns zero or more windows in the group using the custom search function passed to this method.
The function should accept a single <a ext:cls="apf.Window" href="output/apf.Window.html">apf.Window</a> reference as its only argument and should
return true if the window matches the search criteria, otherwise it should return false.
The search function
(optional) The scope in which to execute the function (defaults to the window
that gets passed to the function if not specified)
Executes the specified function once for every window in the group, passing each
window as the only parameter. Returning false from the function will stop the iteration.
The function to execute for each item
(optional) The scope in which to execute the function
The default global window group that is available automatically. To have more than one group of windows
with separate z-order stacks, create additional instances of <a ext:cls="apf.WindowGroup" href="output/apf.WindowGroup.html">apf.WindowGroup</a> as needed.<br><br><i>This class is a singleton and cannot be created directly.</i>
<p>A template class that supports advanced functionality like autofilling arrays, conditional processing with
basic comparison operators, sub-templates, basic math function support, special built-in template variables,
inline code execution and more. XTemplate also provides the templating mechanism built into <a ext:cls="apf.DataView" href="output/apf.DataView.html">apf.DataView</a>.</p>
<p>XTemplate supports many special tags and built-in operators that aren't defined as part of the API, but are
supported in the templates that can be created. The following examples demonstrate all of the supported features.
This is the data object used for reference in each code example:</p>
<pre><code>var data = {
name: 'Jack Slocum',
title: 'Lead Developer',
company: 'apf JS, LLC',
email: 'jack@extjs.com',
address: '4 Red Bulls Drive',
city: 'Cleveland',
state: 'Ohio',
zip: '44102',
drinks: ['Red Bull', 'Coffee', 'Water'],
kids: [{
name: 'Sara Grace',
age:3
},{
name: 'Zachary',
age:2
},{
name: 'John James',
age:0
}]
};</code></pre>
<p><b>Auto filling of arrays and scope switching</b><br/>Using the <tt>tpl</tt> tag and the <tt>for</tt> operator,
you can switch to the scope of the object specified by <tt>for</tt> and access its members to populate the template.
If the variable in <tt>for</tt> is an array, it will auto-fill, repeating the template block inside the <tt>tpl</tt>
tag for each item in the array:</p>
<pre><code>var tpl = new apf.XTemplate(
'<p>Name: {name}</p>',
'<p>Title: {title}</p>',
'<p>Company: {company}</p>',
'<p>Kids: ',
'<tpl for="kids">',
'<p>{name}</p>',
'</tpl></p>'
);
tpl.overwrite(panel.body, data);</code></pre>
<p><b>Access to parent object from within sub-template scope</b><br/>When processing a sub-template, for example while
looping through a child array, you can access the parent object's members via the <tt>parent</tt> object:</p>
<pre><code>var tpl = new apf.XTemplate(
'<p>Name: {name}</p>',
'<p>Kids: ',
'<tpl for="kids">',
'<tpl if="age &gt; 1">', // <-- Note that the > is encoded
'<p>{name}</p>',
'<p>Dad: {parent.name}</p>',
'</tpl>',
'</tpl></p>'
);
tpl.overwrite(panel.body, data);</code></pre>
<p><b>Array item index and basic math support</b> <br/>While processing an array, the special variable <tt>{#}</tt>
will provide the current array index + 1 (starts at 1, not 0). Templates also support the basic math operators
+ - * and / that can be applied directly on numeric data values:</p>
<pre><code>var tpl = new apf.XTemplate(
'<p>Name: {name}</p>',
'<p>Kids: ',
'<tpl for="kids">',
'<tpl if="age &gt; 1">', // <-- Note that the > is encoded
'<p>{#}: {name}</p>', // <-- Auto-number each item
'<p>In 5 Years: {age+5}</p>', // <-- Basic math
'<p>Dad: {parent.name}</p>',
'</tpl>',
'</tpl></p>'
);
tpl.overwrite(panel.body, data);</code></pre>
<p><b>Auto-rendering of flat arrays</b> <br/>Flat arrays that contain values (and not objects) can be auto-rendered
using the special <tt>{.}</tt> variable inside a loop. This variable will represent the value of
the array at the current index:</p>
<pre><code>var tpl = new apf.XTemplate(
'<p>{name}\'s favorite beverages:</p>',
'<tpl for="drinks">',
'<div> - {.}</div>',
'</tpl>'
);
tpl.overwrite(panel.body, data);</code></pre>
<p><b>Basic conditional logic</b> <br/>Using the <tt>tpl</tt> tag and the <tt>if</tt>
operator you can provide conditional checks for deciding whether or not to render specific parts of the template.
Note that there is no <tt>else</tt> operator — if needed, you should use two opposite <tt>if</tt> statements.
Properly-encoded attributes are required as seen in the following example:</p>
<pre><code>var tpl = new apf.XTemplate(
'<p>Name: {name}</p>',
'<p>Kids: ',
'<tpl for="kids">',
'<tpl if="age &gt; 1">', // <-- Note that the > is encoded
'<p>{name}</p>',
'</tpl>',
'</tpl></p>'
);
tpl.overwrite(panel.body, data);</code></pre>
<p><b>Ability to execute arbitrary inline code</b> <br/>In an XTemplate, anything between {[ ... ]} is considered
code to be executed in the scope of the template. There are some special variables available in that code:
<ul>
<li><b><tt>values</tt></b>: The values in the current scope. If you are using scope changing sub-templates, you
can change what <tt>values</tt> is.</li>
<li><b><tt>parent</tt></b>: The scope (values) of the ancestor template.</li>
<li><b><tt>xindex</tt></b>: If you are in a looping template, the index of the loop you are in (1-based).</li>
<li><b><tt>xcount</tt></b>: If you are in a looping template, the total length of the array you are looping.</li>
<li><b><tt>fm</tt></b>: An alias for <tt>apf.util.Format</tt>.</li>
</ul>
This example demonstrates basic row striping using an inline code block and the <tt>xindex</tt> variable:</p>
<pre><code>var tpl = new apf.XTemplate(
'<p>Name: {name}</p>',
'<p>Company: {[values.company.toUpperCase() + ", " + values.title]}</p>',
'<p>Kids: ',
'<tpl for="kids">',
'<div class="{[xindex % 2 === 0 ? "even" : "odd"]}">',
'{name}',
'</div>',
'</tpl></p>'
);
tpl.overwrite(panel.body, data);</code></pre>
<p><b>Template member functions</b> <br/>One or more member functions can be defined directly on the config
object passed into the XTemplate constructor for more complex processing:</p>
<pre><code>var tpl = new apf.XTemplate(
'<p>Name: {name}</p>',
'<p>Kids: ',
'<tpl for="kids">',
'<tpl if="this.isGirl(name)">',
'<p>Girl: {name} - {age}</p>',
'</tpl>',
'<tpl if="this.isGirl(name) == false">',
'<p>Boy: {name} - {age}</p>',
'</tpl>',
'<tpl if="this.isBaby(age)">',
'<p>{name} is a baby!</p>',
'</tpl>',
'</tpl></p>', {
isGirl: function(name){
return name == 'Sara Grace';
},
isBaby: function(age){
return age < 1;
}
});
tpl.overwrite(panel.body, data);</code></pre>
The HTML fragment or an array of fragments to join(""), or multiple arguments
to join("") that can also include a config object
@hide
@hide
Returns an HTML fragment of this template with the specified values applied.
The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})
Compile the template to a function for optimized performance. Recommended if the template will be used frequently.
@hide
<static> Creates a template from the passed element's value (<i>display:none</i> textarea, preferred) or innerHTML.
A DOM element or its id
Alias for <a ext:cls="apf.XTemplate" ext:member="applyTemplate" href="output/apf.XTemplate.html#applyTemplate">applyTemplate</a>
Returns an HTML fragment of this template with the specified values applied.
The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})
Drag drop type constants<br><br><i>This class is a singleton and cannot be created directly.</i>
Constant for text data
Constant for html data
Constant for url data
Constant for bitmap data
Constant for file list data
An apf state provider implementation for Adobe AIR that stores state in the application
storage directory.
Adds ability for apf Observable functionality to proxy events for native (AIR) object wrappers
Wraps the AIR NativeWindow class to give an apf friendly API. <br/><br/>This class also adds
automatic state management (position and size) for the window (by id) and it can be used
for easily creating "minimize to system tray" for the main window in your application.<br/><br/>
Note: Many of the config options for this class can only be applied to NEW windows. Passing
in an existing instance of a window along with those config options will have no effect.
Returns the air.NativeWindow instance
Returns the x/y coordinates for centering the windw on the screen
Shows the window
Shows and activates the window
Hides the window
Closes the window
Returns true if this window is minimized
Returns true if this window is maximized
Moves the window to the passed xy and y coordinates
<static> Returns the first opened window in your application
<static> Returns the javascript "window" object of the first opened window in your application
A collection of NativeWindows.
Closes all windows
Executes the specified function once for every window in the group, passing each
window as the only parameter. Returning false from the function will stop the iteration.
The function to execute for each item
(optional) The scope in which to execute the function
Collection of all NativeWindows created.<br><br><i>This class is a singleton and cannot be created directly.</i>
<br><br><i>This class is a singleton and cannot be created directly.</i>
Play a sound.
The file to be played. The path is resolved against applicationDirectory
(optional) A time in the sound file to skip to before playing
Provides platform independent handling of adding item to the application menu, creating the menu or
items as needed. <br/><br/>
This class also provides the ability to bind standard apf.Action instances with NativeMenuItems<br><br><i>This class is a singleton and cannot be created directly.</i>
Add items to one of the application menus
The application menu to add the actions to (e.g. 'File' or 'Edit').
An array of apf.Action objects or menu item configs
The index of the character in "text" which should be used for
keyboard access
Returns the application menu
Data reader class to create an Array of <a ext:cls="apf.data.Record" href="output/apf.data.Record.html">apf.data.Record</a> objects from an Array.
Each element of that Array represents a row of data fields. The
fields are pulled into a Record object using as a subscript, the <em>mapping</em> property
of the field definition if it exists, or the field's ordinal position in the definition.<br>
<p>
Example code:.
<pre><code>var Employee = apf.data.Record.create([
{name: 'name', mapping: 1}, // "mapping" only needed if an "id" field is present which
{name: 'occupation', mapping: 2} // precludes using the ordinal position as the index.
]);
var myReader = new apf.data.ArrayReader({
id: 0 // The subscript within row Array that provides an ID for the Record (optional)
}, Employee);</code></pre>
<p>
This would consume an Array like this:
<pre><code>[ [1, 'Bill', 'Gardener'], [2, 'Ben', 'Horticulturalist'] ]</code></pre>
Create a new ArrayReader
Metadata configuration options.
Either an Array of field definition objects
as specified to <a ext:cls="apf.data.Record" ext:member="create" href="output/apf.data.Record.html#create">apf.data.Record.create</a>,
or a <a ext:cls="apf.data.Record" href="output/apf.data.Record.html">Record</a> constructor
created using <a ext:cls="apf.data.Record" ext:member="create" href="output/apf.data.Record.html#create">apf.data.Record.create</a>.
Create a data block containing apf.data.Records from an Array.
An Array of row objects which represents the dataset.
<p>The class encapsulates a connection to the page's originating domain, allowing requests to be made
either to a configured URL, or to a URL specified at request time.</p>
<p>Requests made by this class are asynchronous, and will return immediately. No data from
the server will be available to the statement immediately following the <a ext:cls="apf.data.Connection" ext:member="request" href="output/apf.data.Connection.html#request">request</a> call.
To process returned data, use a {@link #request-option-success callback} in the request options object,
or an <a ext:cls="apf.data.Connection" ext:member="requestcomplete" href="output/apf.data.Connection.html#requestcomplete">event listener</a>.</p>
<p>{@link #request-option-isUpload File uploads} are not performed using normal "Ajax" techniques, that
is they are <b>not</b> performed using XMLHttpRequests. Instead the form is submitted in the standard
manner with the DOM <tt><form></tt> element temporarily modified to have its
<a href="http://www.w3.org/TR/REC-html40/present/frames.html#adef-target">target</a> set to refer
to a dynamically generated, hidden <tt><iframe></tt> which is inserted into the document
but removed after the return data has been gathered.</p>
<p>The server response is parsed by the browser to create the document for the IFRAME. If the
server is using JSON to send the return object, then the
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17">Content-Type</a> header
must be set to "text/html" in order to tell the browser to insert the text unchanged into the document body.</p>
<p>The response text is retrieved from the document, and a fake XMLHttpRequest object
is created containing a <tt>responseText</tt> property in order to conform to the
requirements of event handlers and callbacks.</p>
<p>Be aware that file upload packets are sent with the content type <a href="http://www.faqs.org/rfcs/rfc2388.html">multipart/form</a>
and some server technologies (notably JEE) may require some custom processing in order to
retrieve parameter names and parameter values from the packet content.</p>
a configuration object.
<p>Sends an HTTP request to a remote server.</p>
<p><b>Important:</b> Ajax server requests are asynchronous, and this call will
return before the response has been received. Process any returned data
in a callback function.</p>
<p>To execute a callback function in the correct scope, use the <tt>scope</tt> option.</p>
An object which may contain the following properties:<ul>
<li><b>url</b> : String/Function (Optional)<div class="sub-desc">The URL to
which to send the request, or a function to call which returns a URL string. The scope of the
function is specified by the <tt>scope</tt> option. Defaults to configured URL.</div></li>
<li><b>params</b> : Object/String/Function (Optional)<div class="sub-desc">
An object containing properties which are used as parameters to the
request, a url encoded string or a function to call to get either. The scope of the function
is specified by the <tt>scope</tt> option.</div></li>
<li><b>method</b> : String (Optional)<div class="sub-desc">The HTTP method to use
for the request. Defaults to the configured method, or if no method was configured,
"GET" if no parameters are being sent, and "POST" if parameters are being sent. Note that
the method name is case-sensitive and should be all caps.</div></li>
<li><b>callback</b> : Function (Optional)<div class="sub-desc">The
function to be called upon receipt of the HTTP response. The callback is
called regardless of success or failure and is passed the following
parameters:<ul>
<li><b>options</b> : Object<div class="sub-desc">The parameter to the request call.</div></li>
<li><b>success</b> : Boolean<div class="sub-desc">True if the request succeeded.</div></li>
<li><b>response</b> : Object<div class="sub-desc">The XMLHttpRequest object containing the response data.
See <a href="http://www.w3.org/TR/XMLHttpRequest/">http://www.w3.org/TR/XMLHttpRequest/</a> for details about
accessing elements of the response.</div></li>
</ul></div></li>
<a id="request-option-success"></a><li><b>success</b> : Function (Optional)<div class="sub-desc">The function
to be called upon success of the request. The callback is passed the following
parameters:<ul>
<li><b>response</b> : Object<div class="sub-desc">The XMLHttpRequest object containing the response data.</div></li>
<li><b>options</b> : Object<div class="sub-desc">The parameter to the request call.</div></li>
</ul></div></li>
<li><b>failure</b> : Function (Optional)<div class="sub-desc">The function
to be called upon failure of the request. The callback is passed the
following parameters:<ul>
<li><b>response</b> : Object<div class="sub-desc">The XMLHttpRequest object containing the response data.</div></li>
<li><b>options</b> : Object<div class="sub-desc">The parameter to the request call.</div></li>
</ul></div></li>
<li><b>scope</b> : Object (Optional)<div class="sub-desc">The scope in
which to execute the callbacks: The "this" object for the callback function. If the <tt>url</tt>, or <tt>params</tt> options were
specified as functions from which to draw values, then this also serves as the scope for those function calls.
Defaults to the browser window.</div></li>
<li><b>form</b> : Element/HTMLElement/String (Optional)<div class="sub-desc">The <tt><form></tt>
Element or the id of the <tt><form></tt> to pull parameters from.</div></li>
<a id="request-option-isUpload"></a><li><b>isUpload</b> : Boolean (Optional)<div class="sub-desc">True if the form object is a
file upload (will usually be automatically detected).
<p>File uploads are not performed using normal "Ajax" techniques, that is they are <b>not</b>
performed using XMLHttpRequests. Instead the form is submitted in the standard manner with the
DOM <tt><form></tt> element temporarily modified to have its
<a href="http://www.w3.org/TR/REC-html40/present/frames.html#adef-target">target</a> set to refer
to a dynamically generated, hidden <tt><iframe></tt> which is inserted into the document
but removed after the return data has been gathered.</p>
<p>The server response is parsed by the browser to create the document for the IFRAME. If the
server is using JSON to send the return object, then the
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17">Content-Type</a> header
must be set to "text/html" in order to tell the browser to insert the text unchanged into the document body.</p>
<p>The response text is retrieved from the document, and a fake XMLHttpRequest object
is created containing a <tt>responseText</tt> property in order to conform to the
requirements of event handlers and callbacks.</p>
<p>Be aware that file upload packets are sent with the content type <a href="http://www.faqs.org/rfcs/rfc2388.html">multipart/form</a>
and some server technologies (notably JEE) may require some custom processing in order to
retrieve parameter names and parameter values from the packet content.</p>
</div></li>
<li><b>headers</b> : Object (Optional)<div class="sub-desc">Request
headers to set for the request.</div></li>
<li><b>xmlData</b> : Object (Optional)<div class="sub-desc">XML document
to use for the post. Note: This will be used instead of params for the post
data. Any params will be appended to the URL.</div></li>
<li><b>jsonData</b> : Object/String (Optional)<div class="sub-desc">JSON
data to use as the post. Note: This will be used instead of params for the post
data. Any params will be appended to the URL.</div></li>
<li><b>disableCaching</b> : Boolean (Optional)<div class="sub-desc">True
to add a unique cache-buster param to GET requests.</div></li>
</ul></p>
<p>The options object may also contain any other property which might be needed to perform
postprocessing in a callback because it is passed to callback functions.</p>
Determine whether this object has a request outstanding.
(Optional) defaults to the last transaction
Aborts any outstanding request.
(Optional) defaults to the last transaction
This class is an abstract base class for implementations which provide retrieval of
unformatted data objects.<br>
<p>
DataProxy implementations are usually used in conjunction with an implementation of apf.data.DataReader
(of the appropriate type which knows how to parse the data object) to provide a block of
<a ext:cls="apf.data.Records" href="output/apf.data.Records.html">apf.data.Records</a> to an <a ext:cls="apf.data.Store" href="output/apf.data.Store.html">apf.data.Store</a>.<br>
<p>
Custom implementations must implement the load method as described in
<a ext:cls="apf.data.HttpProxy" ext:member="load" href="output/apf.data.HttpProxy.html#load">apf.data.HttpProxy.load</a>.
Abstract base class for reading structured data from a data source and converting
it into an object containing <a ext:cls="apf.data.Record" href="output/apf.data.Record.html">apf.data.Record</a> objects and metadata for use
by an <a ext:cls="apf.data.Store" href="output/apf.data.Store.html">apf.data.Store</a>. This class is intended to be extended and should not
be created directly. For existing implementations, see <a ext:cls="apf.data.ArrayReader" href="output/apf.data.ArrayReader.html">apf.data.ArrayReader</a>,
<a ext:cls="apf.data.JsonReader" href="output/apf.data.JsonReader.html">apf.data.JsonReader</a> and <a ext:cls="apf.data.XmlReader" href="output/apf.data.XmlReader.html">apf.data.XmlReader</a>.
Create a new DataReader
Metadata configuration options (implementation-specific)
Either an Array of field definition objects as specified
in <a ext:cls="apf.data.Record" ext:member="create" href="output/apf.data.Record.html#create">apf.data.Record.create</a>, or an <a ext:cls="apf.data.Record" href="output/apf.data.Record.html">apf.data.Record</a> object created
using <a ext:cls="apf.data.Record" ext:member="create" href="output/apf.data.Record.html#create">apf.data.Record.create</a>.
This DataReader's configured metadata as passed to the constructor.
A specialized store implementation that provides for grouping records by one of the available fields.
Creates a new GroupingStore.
A config object containing the objects needed for the Store to access data,
and read the data into Records.
Clears any existing grouping and refreshes the data using the default sort.
Groups the data by the specified field.
The field name by which to sort the store's data
(optional) True to force the group to be refreshed even if the field passed
in is the same as the current grouping field, false to skip grouping on the same field (defaults to false)
An implementation of <a ext:cls="apf.data.DataProxy" href="output/apf.data.DataProxy.html">apf.data.DataProxy</a> that reads a data object from a <a ext:cls="apf.data.Connection" href="output/apf.data.Connection.html">Connection</a> object
configured to reference a certain URL.<br>
<p>
<b>Note that this class cannot be used to retrieve data from a domain other than the domain
from which the running page was served.<br>
<p>
For cross-domain access to remote data, use a <a ext:cls="apf.data.ScriptTagProxy" href="output/apf.data.ScriptTagProxy.html">ScriptTagProxy</a>.</b><br>
<p>
Be aware that to enable the browser to parse an XML document, the server must set
the Content-Type header in the HTTP response to "text/xml".
an <a ext:cls="apf.data.Connection" href="output/apf.data.Connection.html">apf.data.Connection</a> object, or options parameter to <a ext:cls="apf.Ajax" ext:member="request" href="output/apf.Ajax.html#request">apf.Ajax.request</a>.
If an options parameter is passed, the singleton <a ext:cls="apf.Ajax" href="output/apf.Ajax.html">apf.Ajax</a> object will be used to make the request.
The Connection object (Or options parameter to <a ext:cls="apf.Ajax" ext:member="request" href="output/apf.Ajax.html#request">apf.Ajax.request</a>) which this HttpProxy uses to make requests to the server.
Properties of this object may be changed dynamically to change the way data is requested.
Return the <a ext:cls="apf.data.Connection" href="output/apf.data.Connection.html">apf.data.Connection</a> object being used by this Proxy.
Load data from the configured <a ext:cls="apf.data.Connection" href="output/apf.data.Connection.html">apf.data.Connection</a>, read the data object into
a block of apf.data.Records using the passed <a ext:cls="apf.data.DataReader" href="output/apf.data.DataReader.html">apf.data.DataReader</a> implementation, and
process that block using the passed callback.
An object containing properties which are to be used as HTTP parameters
for the request to the remote server.
The Reader object which converts the data
object into a block of apf.data.Records.
The function into which to pass the block of apf.data.Records.
The function must be passed <ul>
<li>The Record block object</li>
<li>The "arg" argument from the load function</li>
<li>A boolean success indicator</li>
</ul>
The scope in which to call the callback
An optional argument which is passed to the callback as its second parameter.
Data reader class to create an Array of <a ext:cls="apf.data.Record" href="output/apf.data.Record.html">apf.data.Record</a> objects from a JSON response
based on mappings in a provided <a ext:cls="apf.data.Record" href="output/apf.data.Record.html">apf.data.Record</a> constructor.<br>
<p>
Example code:
<pre><code>var Employee = apf.data.Record.create([
{name: 'firstname'}, // Map the Record's "firstname" field to the row object's key of the same name
{name: 'job', mapping: 'occupation'} // Map the "job" field to the row object's "occupation" key
]);
var myReader = new apf.data.JsonReader({
totalProperty: "results", // The property which contains the total dataset size (optional)
root: "rows", // The property which contains an Array of row objects
id: "id" // The property within each row object that provides an ID for the record (optional)
}, Employee);</code></pre>
<p>
This would consume a JSON object of the form:
<pre><code>{
'results': 2,
'rows': [
{ 'id': 1, 'firstname': 'Bill', occupation: 'Gardener' }, // a row object
{ 'id': 2, 'firstname': 'Ben' , occupation: 'Horticulturalist' } // another row object
]
}</code></pre>
<p>It is possible to change a JsonReader's metadata at any time by including a
<b><tt>metaData</tt></b> property in the data object. If this is detected in the
object, a <a ext:cls="apf.data.Store" href="output/apf.data.Store.html">Store</a> object using this Reader will fire its
<a ext:cls="apf.data.Store" ext:member="metachange" href="output/apf.data.Store.html#metachange">metachange</a> event.</p>
<p>The <b><tt>metaData</tt></b> property may contain any of the configuration
options for this class. Additionally, it may contain a <b><tt>fields</tt></b>
property which the JsonReader will use as an argument to <a ext:cls="apf.data.Record" ext:member="create" href="output/apf.data.Record.html#create">apf.data.Record.create</a>
to configure the layout of the Records which it will produce.<p>
Using the <b><tt>metaData</tt></b> property, and the Store's <a ext:cls="apf.data.Store" ext:member="metachange" href="output/apf.data.Store.html#metachange">metachange</a> event,
it is possible to have a Store-driven control initialize itself. The metachange
event handler may interrogate the <b><tt>metaData</tt></b> property (which
may contain any user-defined properties needed) and the <b><tt>metaData.fields</tt></b>
property to perform any configuration required.</p>
<p>To use this facility to send the same data as the above example without
having to code the creation of the Record constructor, you would create the
JsonReader like this:</p><pre><code>var myReader = new apf.data.JsonReader();</code></pre>
<p>The first data packet from the server would configure the reader by
containing a metaData property as well as the data:</p><pre><code>{
'metaData': {
totalProperty: 'results',
root: 'rows',
id: 'id',
fields: [
{name: 'name'},
{name: 'occupation'} ]
},
'results': 2, 'rows': [
{ 'id': 1, 'name': 'Bill', occupation: 'Gardener' },
{ 'id': 2, 'name': 'Ben', occupation: 'Horticulturalist' } ]
}</code></pre>
Create a new JsonReader
Metadata configuration options.
Either an Array of field definition objects as passed to
<a ext:cls="apf.data.Record" ext:member="create" href="output/apf.data.Record.html#create">apf.data.Record.create</a>, or a <a ext:cls="apf.data.Record" href="output/apf.data.Record.html">Record</a> constructor created using <a ext:cls="apf.data.Record" ext:member="create" href="output/apf.data.Record.html#create">apf.data.Record.create</a>.
This JsonReader's metadata as passed to the constructor, or as passed in
the last data packet's <b><tt>metaData</tt></b> property.
After any data loads, the raw JSON data is available for further custom processing. If no data is
loaded or there is a load exception this property will be undefined.
This method is only used by a DataProxy which has retrieved data from a remote server.
The XHR object which contains the JSON data in its responseText.
Create a data block containing apf.data.Records from a JSON object.
An object which contains an Array of row objects in the property specified
in the config as 'root, and optionally a property, specified in the config as 'totalProperty'
which contains the total size of the dataset.
Small helper class to make creating Stores for remotely-loaded JSON data easier. JsonStore is pre-configured
with a built-in <a ext:cls="apf.data.HttpProxy" href="output/apf.data.HttpProxy.html">apf.data.HttpProxy</a> and <a ext:cls="apf.data.JsonReader" href="output/apf.data.JsonReader.html">apf.data.JsonReader</a>. If you require some other proxy/reader
combination then you'll have to create a basic <a ext:cls="apf.data.Store" href="output/apf.data.Store.html">apf.data.Store</a> configured as needed.<br/>
<pre><code>var store = new apf.data.JsonStore({
url: 'get-images.php',
root: 'images',
fields: ['name', 'url', {name:'size', type: 'float'}, {name:'lastmod', type:'date'}]
});</code></pre>
This would consume a returned object of the form:
<pre><code>{
images: [
{name: 'Image one', url:'/GetImage.php?id=1', size:46.5, lastmod: new Date(2007, 10, 29)},
{name: 'Image Two', url:'/GetImage.php?id=2', size:43.2, lastmod: new Date(2007, 10, 30)}
]
}</code></pre>
An object literal of this form could also be used as the <a ext:cls="apf.data.JsonStore" ext:member="data" href="output/apf.data.JsonStore.html#data">data</a> config option.
<b>Note: Although they are not listed, this class inherits all of the config options of Store,
JsonReader.</b>
An implementation of apf.data.DataProxy that simply passes the data specified in its constructor
to the Reader when its load method is called.
The data object which the Reader uses to construct a block of apf.data.Records.
Load data from the requested source (in this case an in-memory
data object passed to the constructor), read the data object into
a block of apf.data.Records using the passed apf.data.DataReader implementation, and
process that block using the passed callback.
This parameter is not used by the MemoryProxy class.
The Reader object which converts the data
object into a block of apf.data.Records.
The function into which to pass the block of apf.data.records.
The function must be passed <ul>
<li>The Record block object</li>
<li>The "arg" argument from the load function</li>
<li>A boolean success indicator</li>
</ul>
The scope in which to call the callback
An optional argument which is passed to the callback as its second parameter.
The attributes/config for the node
The attributes supplied for the node. You can use this property to access any custom attributes you supplied.
The node id.
All child nodes of this node.
The parent node for this node.
The first direct child node of this node, or null if this node has no child nodes.
The last direct child node of this node, or null if this node has no child nodes.
The node immediately preceding this node in the tree, or null if there is no sibling node.
The node immediately following this node in the tree, or null if there is no sibling node.
Returns true if this node is a leaf
Returns true if this node is the last child of its parent
Returns true if this node is the first child of its parent
Returns true if this node has one or more child nodes, else false.
Returns true if this node has one or more child nodes, or if the <tt>expandable</tt>
node attribute is explicitly specified as true (see <a ext:cls="apf.data.Node" ext:member="attributes" href="output/apf.data.Node.html#attributes">attributes</a>), otherwise returns false.
Insert node(s) as the last child node of this node.
The node or Array of nodes to append
Removes a child node from this node.
The node to remove
Inserts the first node before the second node in this nodes childNodes collection.
The node to insert
The node to insert before (if null the node is appended)
Removes this node from it's parent
Returns the child node at the specified index.
Replaces one child node in this node with another.
The replacement node
The node to replace
Returns the index of a child node
Returns the tree this node is in.
Returns depth of this node (the root node has a depth of 0)
Returns the path for this node. The path can be used to expand or select this node programmatically.
(optional) The attr to use for the path (defaults to the node's id)
Bubbles up the tree from this node, calling the specified function with each node. The scope (<i>this</i>) of
function call will be the scope provided or the current node. The arguments to the function
will be the args provided or the current node. If the function returns false at any point,
the bubble is stopped.
The function to call
(optional) The scope of the function (defaults to current node)
(optional) The args to call the function with (default to passing the current node)
Cascades down the tree from this node, calling the specified function with each node. The scope (<i>this</i>) of
function call will be the scope provided or the current node. The arguments to the function
will be the args provided or the current node. If the function returns false at any point,
the cascade is stopped on that branch.
The function to call
(optional) The scope of the function (defaults to current node)
(optional) The args to call the function with (default to passing the current node)
Iterates the child nodes of this node, calling the specified function with each node. The scope (<i>this</i>) of
function call will be the scope provided or the current node. The arguments to the function
will be the args provided or the current node. If the function returns false at any point,
the iteration stops.
The function to call
(optional) The scope of the function (defaults to current node)
(optional) The args to call the function with (default to passing the current node)
Finds the first child that has the attribute with the specified value.
The attribute name
The value to search for
Finds the first child by a custom function. The child matches if the function passed
returns true.
(optional)
Sorts this nodes children using the supplied sort function
(optional)
Returns true if this node is an ancestor (at any point) of the passed node.
Returns true if the passed node is an ancestor (at any point) of this node.
Instances of this class encapsulate both Record <em>definition</em> information, and Record
<em>value</em> information for use in <a ext:cls="apf.data.Store" href="output/apf.data.Store.html">apf.data.Store</a> objects, or any code which needs
to access Records cached in an <a ext:cls="apf.data.Store" href="output/apf.data.Store.html">apf.data.Store</a> object.<br>
<p>
Constructors for this class are generated by passing an Array of field definition objects to <a ext:cls="apf.data.Record" ext:member="create" href="output/apf.data.Record.html#create">create</a>.
Instances are usually only created by <a ext:cls="apf.data.Reader" href="output/apf.data.Reader.html">apf.data.Reader</a> implementations when processing unformatted data
objects.<br>
<p>
Record objects generated by this constructor inherit all the methods of apf.data.Record listed below.
This constructor should not be used to create Record objects. Instead, use the constructor generated by
<a ext:cls="apf.data.Record" ext:member="create" href="output/apf.data.Record.html#create">create</a>. The parameters are the same.
An object, the properties of which provide values for the new Record's fields.
(Optional) The id of the Record. This id should be unique, and is used by the
<a ext:cls="apf.data.Store" href="output/apf.data.Store.html">apf.data.Store</a> object which owns the Record to index its collection of Records. If
not specified an integer id is generated.
An object hash representing the data for this Record.
The unique ID of the Record as specified at construction time.
Readonly flag - true if this Record has been modified.
This object contains a key and value storing the original values of all modified fields or is null if no fields have been modified.
<static> Generate a constructor for a specific Record layout.
An Array of field definition objects which specify field names, and optionally,
data types, and a mapping for an <a ext:cls="apf.data.Reader" href="output/apf.data.Reader.html">apf.data.Reader</a> to extract the field's value from a data object.
Each field definition object may contain the following properties: <ul>
<li><b>name</b> : String<div class="sub-desc">The name by which the field is referenced within the Record. This is referenced by,
for example, the <em>dataIndex</em> property in column definition objects passed to <a ext:cls="apf.grid.ColumnModel" href="output/apf.grid.ColumnModel.html">apf.grid.ColumnModel</a></div></li>
<li><b>mapping</b> : String<div class="sub-desc">(Optional) A path specification for use by the <a ext:cls="apf.data.Reader" href="output/apf.data.Reader.html">apf.data.Reader</a> implementation
that is creating the Record to access the data value from the data object. If an <a ext:cls="apf.data.JsonReader" href="output/apf.data.JsonReader.html">apf.data.JsonReader</a>
is being used, then this is a string containing the javascript expression to reference the data relative to
the Record item's root. If an <a ext:cls="apf.data.XmlReader" href="output/apf.data.XmlReader.html">apf.data.XmlReader</a> is being used, this is an <a ext:cls="apf.DomQuery" href="output/apf.DomQuery.html">apf.DomQuery</a> path
to the data item relative to the Record element. If the mapping expression is the same as the field name,
this may be omitted.</div></li>
<li><b>type</b> : String<div class="sub-desc">(Optional) The data type for conversion to displayable value. Possible values are
<ul><li>auto (Default, implies no conversion)</li>
<li>string</li>
<li>int</li>
<li>float</li>
<li>boolean</li>
<li>date</li></ul></div></li>
<li><b>sortType</b> : Mixed<div class="sub-desc">(Optional) A member of <a ext:cls="apf.data.SortTypes" href="output/apf.data.SortTypes.html">apf.data.SortTypes</a>.</div></li>
<li><b>sortDir</b> : String<div class="sub-desc">(Optional) Initial direction to sort. "ASC" or "DESC"</div></li>
<li><b>convert</b> : Function<div class="sub-desc">(Optional) A function which converts the value provided
by the Reader into an object that will be stored in the Record. It is passed the
following parameters:<ul>
<li><b>v</b> : Mixed<div class="sub-desc">The data value as read by the Reader.</div></li>
<li><b>rec</b> : Mixed<div class="sub-desc">The data object containing the row as read by the Reader.
Depending on Reader type, this could be an Array, an object, or an XML element.</div></li>
</ul></div></li>
<li><b>dateFormat</b> : String<div class="sub-desc">(Optional) A format String for the Date.parseDate function.</div></li>
<li><b>defaultValue</b> : Mixed<div class="sub-desc">(Optional) The default value passed to the Reader when the field does
not exist in the data object (i.e. undefined). (defaults to "")</div></li>
</ul>
<br>usage:<br><pre><code>var TopicRecord = apf.data.Record.create([
{name: 'title', mapping: 'topic_title'},
{name: 'author', mapping: 'username'},
{name: 'totalPosts', mapping: 'topic_replies', type: 'int'},
{name: 'lastPost', mapping: 'post_time', type: 'date'},
{name: 'lastPoster', mapping: 'user2'},
{name: 'excerpt', mapping: 'post_text'}
]);
var myNewRecord = new TopicRecord({
topic_title: 'Do my job please',
username: 'noobie',
topic_replies: 1,
post_time: new Date(),
user2: 'Animal',
post_text: 'No way dude!'
});
myStore.add(myNewRecord);</code></pre>
<p>In the simplest case, if no properties other than <tt>name</tt> are required, a field definition
may consist of just a field name string.</p>
Set the named field to the specified value.
The name of the field to set.
The value to set the field to.
Get the value of the named field.
The name of the field to get the value of.
Begin an edit. While in edit mode, no events are relayed to the containing store.
Cancels all changes made in the current edit operation.
End an edit. If any data was modified, the containing store is notified.
Usually called by the <a ext:cls="apf.data.Store" href="output/apf.data.Store.html">apf.data.Store</a> which owns the Record.
Rejects all changes made to the Record since either creation, or the last commit operation.
Modified fields are reverted to their original values.
<p>
Developers should subscribe to the <a ext:cls="apf.data.Store" ext:member="update" href="output/apf.data.Store.html#update">apf.data.Store.update</a> event to have their code notified
of reject operations.
(optional) True to skip notification of the owning store of the change (defaults to false)
Usually called by the <a ext:cls="apf.data.Store" href="output/apf.data.Store.html">apf.data.Store</a> which owns the Record.
Commits all changes made to the Record since either creation, or the last commit operation.
<p>
Developers should subscribe to the <a ext:cls="apf.data.Store" ext:member="update" href="output/apf.data.Store.html#update">apf.data.Store.update</a> event to have their code notified
of commit operations.
(optional) True to skip notification of the owning store of the change (defaults to false)
Gets a hash of only the fields that have been modified since this Record was created or commited.
Creates a copy of this Record.
(optional) A new Record id if you don't want to use this Record's id
Returns true if the field passed has been modified since the load or last commit.
An implementation of apf.data.DataProxy that reads a data object from a URL which may be in a domain
other than the originating domain of the running page.<br>
<p>
<b>Note that if you are retrieving data from a page that is in a domain that is NOT the same as the originating domain
of the running page, you must use this class, rather than HttpProxy.</b><br>
<p>
The content passed back from a server resource requested by a ScriptTagProxy <b>must</b> be executable JavaScript
source code because it is used as the source inside a <script> tag.<br>
<p>
In order for the browser to process the returned data, the server must wrap the data object
with a call to a callback function, the name of which is passed as a parameter by the ScriptTagProxy.
Below is a Java example for a servlet which returns data for either a ScriptTagProxy, or an HttpProxy
depending on whether the callback name was passed:
<p>
<pre><code>boolean scriptTag = false;
String cb = request.getParameter("callback");
if (cb != null) {
scriptTag = true;
response.setContentType("text/javascript");
} else {
response.setContentType("application/x-json");
}
Writer out = response.getWriter();
if (scriptTag) {
out.write(cb + "(");
}
out.print(dataBlock.toJsonString());
if (scriptTag) {
out.write(");");
}</code></pre>
A configuration object.
Load data from the configured URL, read the data object into
a block of apf.data.Records using the passed apf.data.DataReader implementation, and
process that block using the passed callback.
An object containing properties which are to be used as HTTP parameters
for the request to the remote server.
The Reader object which converts the data
object into a block of apf.data.Records.
The function into which to pass the block of apf.data.Records.
The function must be passed <ul>
<li>The Record block object</li>
<li>The "arg" argument from the load function</li>
<li>A boolean success indicator</li>
</ul>
The scope in which to call the callback
An optional argument which is passed to the callback as its second parameter.
Abort the current server request.
Small helper class to make creating Stores from Array data easier.
<br><br><i>This class is a singleton and cannot be created directly.</i>
The regular expression used to strip tags
Default sort that does nothing
The value being converted
Strips all HTML tags to sort on text only
The value being converted
Strips all HTML tags to sort on text only - Case insensitive
The value being converted
Case insensitive string
The value being converted
Date sorting
The value being converted
Float sorting
The value being converted
Integer sorting
The value being converted
The Store class encapsulates a client side cache of <a ext:cls="apf.data.Record" href="output/apf.data.Record.html">Record</a>
objects which provide input data for Components such as the <a ext:cls="apf.grid.GridPanel" href="output/apf.grid.GridPanel.html">GridPanel</a>,
the <a ext:cls="apf.form.ComboBox" href="output/apf.form.ComboBox.html">ComboBox</a>, or the <a ext:cls="apf.DataView" href="output/apf.DataView.html">DataView</a></p>
<p>A Store object uses its <a ext:cls="apf.data.Store" ext:member="proxy" href="output/apf.data.Store.html#proxy">configured</a> implementation of <a ext:cls="apf.data.DataProxy" href="output/apf.data.DataProxy.html">DataProxy</a>
to access a data object unless you call <a ext:cls="apf.data.Store" ext:member="loadData" href="output/apf.data.Store.html#loadData">loadData</a> directly and pass in your data.</p>
<p>A Store object has no knowledge of the format of the data returned by the Proxy.</p>
<p>A Store object uses its <a ext:cls="apf.data.Store" ext:member="reader" href="output/apf.data.Store.html#reader">configured</a> implementation of <a ext:cls="apf.data.DataReader" href="output/apf.data.DataReader.html">DataReader</a>
to create <a ext:cls="apf.data.Record" href="output/apf.data.Record.html">Record</a> instances from the data object. These Records
are cached and made available through accessor functions.</p>
Creates a new Store.
A config object containing the objects needed for the Store to access data,
and read the data into Records.
An object containing properties which are used as parameters on any HTTP request.
This property can be changed after creating the Store to send different parameters.
Contains the last options object used as the parameter to the load method. See <a ext:cls="apf.data.Store" ext:member="load" href="output/apf.data.Store.html#load">load</a>
for the details of what this may contain. This may be useful for accessing any params which
were used to load the current Record cache.
Add Records to the Store and fires the <a ext:cls="apf.data.Store" ext:member="add" href="output/apf.data.Store.html#add">add</a> event.
An Array of apf.data.Record objects to add to the cache.
(Local sort only) Inserts the passed Record into the Store at the index where it
should go based on the current sort information.
Remove a Record from the Store and fires the <a ext:cls="apf.data.Store" ext:member="remove" href="output/apf.data.Store.html#remove">remove</a> event.
Th apf.data.Record object to remove from the cache.
Remove all Records from the Store and fires the <a ext:cls="apf.data.Store" ext:member="clear" href="output/apf.data.Store.html#clear">clear</a> event.
Inserts Records into the Store at the given index and fires the <a ext:cls="apf.data.Store" ext:member="add" href="output/apf.data.Store.html#add">add</a> event.
The start index at which to insert the passed Records.
An Array of apf.data.Record objects to add to the cache.
Get the index within the cache of the passed Record.
The apf.data.Record object to find.
Get the index within the cache of the Record with the passed id.
The id of the Record to find.
Get the Record with the specified id.
The id of the Record to find.
Get the Record at the specified index.
The index of the Record to find.
Returns a range of Records between specified indices.
(optional) The starting index (defaults to 0)
(optional) The ending index (defaults to the last Record in the Store)
Loads the Record cache from the configured Proxy using the configured Reader.
<p>If using remote paging, then the first load call must specify the <tt>start</tt>
and <tt>limit</tt> properties in the options.params property to establish the initial
position within the dataset, and the number of Records to cache on each read from the Proxy.</p>
<p><b>It is important to note that for remote data sources, loading is asynchronous,
and this call will return before the new data has been loaded. Perform any post-processing
in a callback function, or in a "load" event handler.</b></p>
An object containing properties which control loading options:<ul>
<li><b>params</b> :Object<p class="sub-desc">An object containing properties to pass as HTTP parameters to a remote data source.</p></li>
<li><b>callback</b> : Function<p class="sub-desc">A function to be called after the Records have been loaded. The callback is
passed the following arguments:<ul>
<li>r : apf.data.Record[]</li>
<li>options: Options object from the load call</li>
<li>success: Boolean success indicator</li></ul></p></li>
<li><b>scope</b> : Object<p class="sub-desc">Scope with which to call the callback (defaults to the Store object)</p></li>
<li><b>add</b> : Boolean<p class="sub-desc">Indicator to append loaded records rather than replace the current cache.</p></li>
</ul>
Reloads the Record cache from the configured Proxy using the configured Reader and
the options from the last load operation performed.
(optional) An object containing properties which may override the options
used in the last load operation. See <a ext:cls="apf.data.Store" ext:member="load" href="output/apf.data.Store.html#load">load</a> for details (defaults to null, in which case
the most recently used options are reused).
Loads data from a passed data block and fires the <a ext:cls="apf.data.Store" ext:member="load" href="output/apf.data.Store.html#load">load</a> event. A Reader which understands the format of the data
must have been configured in the constructor.
The data block from which to read the Records. The format of the data expected
is dependent on the type of Reader that is configured and should correspond to that Reader's readRecords parameter.
(Optional) True to append the new Records rather than replace the existing cache.
Gets the number of cached records.
<p>If using paging, this may not be the total size of the dataset. If the data object
used by the Reader contains the dataset size, then the <a ext:cls="apf.data.Store" ext:member="getTotalCount" href="output/apf.data.Store.html#getTotalCount">getTotalCount</a> function returns
the dataset size.</p>
Gets the total number of records in the dataset as returned by the server.
<p>If using paging, for this to be accurate, the data object used by the Reader must contain
the dataset size. For remote data sources, this is provided by a query on the server.</p>
Returns an object describing the current sort state of this Store.
Sets the default sort column and order to be used by the next load operation.
The name of the field to sort by.
(optional) The sort order, "ASC" or "DESC" (case-sensitive, defaults to "ASC")
Sort the Records.
If remote sorting is used, the sort is performed on the server, and the cache is
reloaded. If local sorting is used, the cache is sorted internally.
The name of the field to sort by.
(optional) The sort order, "ASC" or "DESC" (case-sensitive, defaults to "ASC")
Calls the specified function for each of the Records in the cache.
The function to call. The Record is passed as the first parameter.
Returning <tt>false</tt> aborts and exits the iteration.
(optional) The scope in which to call the function (defaults to the Record).
Gets all records modified since the last commit. Modified records are persisted across load operations
(e.g., during paging).
Sums the value of <i>property</i> for each record between start and end and returns the result.
A field on your records
The record index to start at (defaults to 0)
The last record index to include (defaults to length - 1)
Filter the records by a specified property.
A field on your records
Either a string that the field
should begin with, or a RegExp to test against the field.
(optional) True to match any part not just the beginning
(optional) True for case sensitive comparison
Filter by a function. The specified function will be called for each
Record in this Store. If the function returns <tt>true</tt> the Record is included,
otherwise it is filtered out.
The function to be called. It will be passed the following parameters:<ul>
<li><b>record</b> : apf.data.Record<p class="sub-desc">The <a ext:cls="apf.data.Record" href="output/apf.data.Record.html">record</a>
to test for filtering. Access field values using <a ext:cls="apf.data.Record" ext:member="get" href="output/apf.data.Record.html#get">apf.data.Record.get</a>.</p></li>
<li><b>id</b> : Object<p class="sub-desc">The ID of the Record passed.</p></li>
</ul>
(optional) The scope of the function (defaults to this)
Query the records by a specified property.
A field on your records
Either a string that the field
should begin with, or a RegExp to test against the field.
(optional) True to match any part not just the beginning
(optional) True for case sensitive comparison
Query the cached records in this Store using a filtering function. The specified function
will be called with each record in this Store. If the function returns <tt>true</tt> the record is
included in the results.
The function to be called. It will be passed the following parameters:<ul>
<li><b>record</b> : apf.data.Record<p class="sub-desc">The <a ext:cls="apf.data.Record" href="output/apf.data.Record.html">record</a>
to test for filtering. Access field values using <a ext:cls="apf.data.Record" ext:member="get" href="output/apf.data.Record.html#get">apf.data.Record.get</a>.</p></li>
<li><b>id</b> : Object<p class="sub-desc">The ID of the Record passed.</p></li>
</ul>
(optional) The scope of the function (defaults to this)
Finds the index of the first matching record in this store by a specific property/value.
A property on your objects
Either a string that the property value
should begin with, or a RegExp to test against the property.
(optional) The index to start searching at
(optional) True to match any part of the string, not just the beginning
(optional) True for case sensitive comparison
Find the index of the first matching Record in this Store by a function.
If the function returns <tt>true</tt> it is considered a match.
The function to be called. It will be passed the following parameters:<ul>
<li><b>record</b> : apf.data.Record<p class="sub-desc">The <a ext:cls="apf.data.Record" href="output/apf.data.Record.html">record</a>
to test for filtering. Access field values using <a ext:cls="apf.data.Record" ext:member="get" href="output/apf.data.Record.html#get">apf.data.Record.get</a>.</p></li>
<li><b>id</b> : Object<p class="sub-desc">The ID of the Record passed.</p></li>
</ul>
(optional) The scope of the function (defaults to this)
(optional) The index to start searching at
Collects unique values for a particular dataIndex from this store.
The property to collect
(optional) Pass true to allow null, undefined or empty string values
(optional) Pass true to collect from all records, even ones which are filtered
Revert to a view of the Record cache with no filtering applied.
If true the filter is cleared silently without notifying listeners
Returns true if this store is currently filtered
Commit all Records with outstanding changes. To handle updates for changes, subscribe to the
Store's "update" event, and perform updating when the third parameter is apf.data.Record.COMMIT.
Cancel outstanding changes on all changed records.
Represents a tree data structure and bubbles all the events for its nodes. The nodes
in the tree have most standard DOM functionality.
(optional) The root node
The root node for this tree
Returns the root node for this tree.
Sets the root node for this tree.
Gets a node in this tree by its id.
Data reader class to create an Array of <a ext:cls="apf.data.Record" href="output/apf.data.Record.html">apf.data.Record</a> objects from an XML document
based on mappings in a provided <a ext:cls="apf.data.Record" href="output/apf.data.Record.html">apf.data.Record</a> constructor.<br><br>
<p>
<em>Note that in order for the browser to parse a returned XML document, the Content-Type
header in the HTTP response must be set to "text/xml" or "application/xml".</em>
<p>
Example code:
<pre><code>var Employee = apf.data.Record.create([
{name: 'name', mapping: 'name'}, // "mapping" property not needed if it's the same as "name"
{name: 'occupation'} // This field will use "occupation" as the mapping.
]);
var myReader = new apf.data.XmlReader({
totalRecords: "results", // The element which contains the total dataset size (optional)
record: "row", // The repeated element which contains row information
id: "id" // The element within the row that provides an ID for the record (optional)
}, Employee);</code></pre>
<p>
This would consume an XML file like this:
<pre><code><?xml version="1.0" encoding="UTF-8"?>
<dataset>
<results>2</results>
<row>
<id>1</id>
<name>Bill</name>
<occupation>Gardener</occupation>
</row>
<row>
<id>2</id>
<name>Ben</name>
<occupation>Horticulturalist</occupation>
</row>
</dataset></code></pre>
Create a new XmlReader.
Metadata configuration options
Either an Array of field definition objects as passed to
<a ext:cls="apf.data.Record" ext:member="create" href="output/apf.data.Record.html#create">apf.data.Record.create</a>, or a Record constructor object created using <a ext:cls="apf.data.Record" ext:member="create" href="output/apf.data.Record.html#create">apf.data.Record.create</a>.
After any data loads/reads, the raw XML Document is available for further custom processing.
This method is only used by a DataProxy which has retrieved data from a remote server.
The XHR object which contains the parsed XML document. The response is expected
to contain a property called <tt>responseXML</tt> which refers to an XML document object.
Create a data block containing apf.data.Records from an XML document.
A parsed XML document.
A DragDrop implementation where the linked element follows the
mouse cursor during a drag.
the id of the linked element
the group of related DragDrop items
an object containing configurable attributes
Valid properties for DD:
scroll
When set to true, the utility automatically tries to scroll the browser
window when a drag and drop element is dragged near the viewport boundary.
Defaults to true.
Sets the pointer offset to the distance between the linked element's top
left corner and the location the element was clicked
the X coordinate of the click
the Y coordinate of the click
Sets the pointer offset. You can call this directly to force the
offset to be in a particular location (e.g., pass in 0,0 to set it
to the center of the object)
the distance from the left
the distance from the top
Sets the drag element to the location of the mousedown or click event,
maintaining the cursor location relative to the location on the element
that was clicked. Override this if you want to place the element in a
location other than where the cursor is.
the X coordinate of the mousedown or drag event
the Y coordinate of the mousedown or drag event
Sets the element to the location of the mousedown or click event,
maintaining the cursor location relative to the location on the element
that was clicked. Override this if you want to place the element in a
location other than where the cursor is.
the element to move
the X coordinate of the mousedown or drag event
the Y coordinate of the mousedown or drag event
Saves the most recent position so that we can reset the constraints and
tick marks on-demand. We need to know this so that we can calculate the
number of pixels the element is offset from its original position.
current x position (optional, this just makes it so we
don't have to look it up again)
current y position (optional, this just makes it so we
don't have to look it up again)
Sets up config options specific to this class. Overrides
apf.dd.DragDrop, but all versions of this method through the
inheritance chain are called
Event that fires prior to the onMouseDown event. Overrides
apf.dd.DragDrop.
Event that fires prior to the onDrag event. Overrides
apf.dd.DragDrop.
A DragDrop implementation that inserts an empty, bordered div into
the document that follows the cursor during drag operations. At the time of
the click, the frame div is resized to the dimensions of the linked html
element, and moved to the exact location of the linked element.
References to the "frame" element refer to the single proxy element that
was created to be dragged in place of all DDProxy elements on the
page.
the id of the linked html element
the group of related DragDrop objects
an object containing configurable attributes
Valid properties for DDProxy in addition to those in DragDrop:
resizeFrame, centerFrame, dragElId
<static> The default drag frame div id
By default we resize the drag frame to be the same size as the element
we want to drag (this is to get the frame effect). We can turn it off
if we want a different behavior.
By default the frame is positioned exactly where the drag element is, so
we use the cursor offset provided by apf.dd.DD. Another option that works only if
you do not have constraints on the obj is to have the drag frame centered
around the cursor. Set centerFrame to true for this effect.
Creates the proxy element if it does not yet exist
Initialization for the drag frame element. Must be called in the
constructor of all subclasses
A DragDrop implementation that does not move, but can be a drop
target. You would get the same result by simply omitting implementation
for the event callbacks, but this way we reduce the processing cost of the
event listener and the callbacks.
the id of the element that is a drop target
the group of related DragDrop objects
an object containing configurable attributes
Valid properties for DDTarget in addition to those in
DragDrop:
none
Defines the interface and base operation of items that that can be
dragged or can be drop targets. It was designed to be extended, overriding
the event handlers for startDrag, onDrag, onDragOver and onDragOut.
Up to three html elements can be associated with a DragDrop instance:
<ul>
<li>linked element: the element that is passed into the constructor.
This is the element which defines the boundaries for interaction with
other DragDrop objects.</li>
<li>handle element(s): The drag operation only occurs if the element that
was clicked matches a handle element. By default this is the linked
element, but there are times that you will want only a portion of the
linked element to initiate the drag operation, and the setHandleElId()
method provides a way to define this.</li>
<li>drag element: this represents the element that would be moved along
with the cursor during a drag operation. By default, this is the linked
element itself as in <a ext:cls="apf.dd.DD" href="output/apf.dd.DD.html">apf.dd.DD</a>. setDragElId() lets you define
a separate element that would be moved, as in <a ext:cls="apf.dd.DDProxy" href="output/apf.dd.DDProxy.html">apf.dd.DDProxy</a>.
</li>
</ul>
This class should not be instantiated until the onload event to ensure that
the associated elements are available.
The following would define a DragDrop obj that would interact with any
other DragDrop obj in the "group1" group:
<pre>dd = new apf.dd.DragDrop("div1", "group1");</pre>
Since none of the event handlers have been implemented, nothing would
actually happen if you were to run the code above. Normally you would
override this class or one of the default implementations, but you can
also override the methods you want on an instance of the class...
<pre>dd.onDragDrop = function(e, id) {
alert("dd was dropped on " + id);
}</pre>
of the element that is linked to this instance
the group of related DragDrop objects
an object containing configurable attributes
Valid properties for DragDrop:
padding, isTarget, maintainOffset, primaryButtonOnly
The id of the element associated with this object. This is what we
refer to as the "linked element" because the size and position of
this element is used to determine when the drag and drop objects have
interacted.
Configuration attributes passed into the constructor
An object who's property names identify HTML tags to be considered invalid as drag handles.
A non-null property value identifies the tag as invalid. Defaults to the
following value which prevents drag operations from being initiated by <a> elements:<pre><code>{
A: "A"
}</code></pre>
An object who's property names identify the IDs of elements to be considered invalid as drag handles.
A non-null property value identifies the ID as invalid. For example, to prevent
dragging from being initiated on element ID "foo", use:<pre><code>{
foo: true
}</code></pre>
An Array of CSS class names for elements to be considered in valid as drag handles.
The group defines a logical collection of DragDrop objects that are
related. Instances only get events when interacting with other
DragDrop object in the same group. This lets us define multiple
groups using a single DragDrop subclass if we want.
By default, all insances can be a drop target. This can be disabled by
setting isTarget to false.
The padding configured for this drag and drop object for calculating
the drop zone intersection with this object.
Maintain offsets when we resetconstraints. Set to true when you want
the position of the element relative to its parent to stay the same
when the page changes
Array of pixel locations the element will snap to if we specified a
horizontal graduation/interval. This array is generated automatically
when you define a tick interval.
Array of pixel locations the element will snap to if we specified a
vertical graduation/interval. This array is generated automatically
when you define a tick interval.
By default the drag and drop instance will only respond to the primary
button click (left button for a right-handed mouse). Set to true to
allow drag and drop to start with any mouse click that is propogated
by the browser
The availabe property is false until the linked dom element is accessible.
By default, drags can only be initiated if the mousedown occurs in the
region the linked element is. This is done in part to work around a
bug in some browsers that mis-report the mousedown if the previous
mouseup happened outside of the window. This property is set to true
if outer handles are defined.
Provides default constraint padding to "constrainTo" elements (defaults to {left: 0, right:0, top:0, bottom:0}).
Lock this instance
Unlock this instace
Abstract method called after a drag/drop object is clicked
and the drag or mousedown time thresholds have beeen met.
click location
click location
Abstract method called during the onMouseMove event while dragging an
object.
the mousemove event
Abstract method called when this element fist begins hovering over
another DragDrop obj
the mousemove event
In POINT mode, the element
id this is hovering over. In INTERSECT mode, an array of one or more
dragdrop items being hovered over.
Abstract method called when this element is hovering over another
DragDrop obj
the mousemove event
In POINT mode, the element
id this is hovering over. In INTERSECT mode, an array of dd items
being hovered over.
Abstract method called when we are no longer hovering over an element
the mousemove event
In POINT mode, the element
id this was hovering over. In INTERSECT mode, an array of dd items
that the mouse is no longer over.
Abstract method called when this item is dropped on another DragDrop
obj
the mouseup event
In POINT mode, the element
id this was dropped on. In INTERSECT mode, an array of dd items this
was dropped on.
Abstract method called when this item is dropped on an area with no
drop target
the mouseup event
Fired when we are done dragging the object
the mouseup event
Event handler that fires when a drag/drop obj gets a mousedown
the mousedown event
Event handler that fires when a drag/drop obj gets a mouseup
the mouseup event
Override the onAvailable method to do what is needed after the initial
position was determined.
Initializes the drag drop object's constraints to restrict movement to a certain element.
Usage:
<pre><code>var dd = new apf.dd.DDProxy("dragDiv1", "proxytest",
{ dragElId: "existingProxyDiv" });
dd.startDrag = function(){
this.constrainTo("parent-id");
};</code></pre>
Or you can initalize it using the <a ext:cls="apf.Element" href="output/apf.Element.html">apf.Element</a> object:
<pre><code>apf.get("dragDiv1").initDDProxy("proxytest", {dragElId: "existingProxyDiv"}, {
startDrag : function(){
this.constrainTo("parent-id");
}
});</code></pre>
The element to constrain to.
(optional) Pad provides a way to specify "padding" of the constraints,
and can be either a number for symmetrical padding (4 would be equal to {left:4, right:4, top:4, bottom:4}) or
an object containing the sides to pad. For example: {right:10, bottom:10}
(optional) Constrain the draggable in the content box of the element (inside padding and borders)
Returns a reference to the linked element
Returns a reference to the actual element to drag. By default this is
the same as the html element, but it can be assigned to another
element. An example of this can be found in apf.dd.DDProxy
Sets up the DragDrop object. Must be called in the constructor of any
apf.dd.DragDrop subclass
id of the linked element
the group of related items
configuration attributes
Initializes Targeting functionality only... the object does not
get a mousedown handler.
id of the linked element
the group of related items
configuration attributes
Applies the configuration parameters that were passed into the constructor.
This is supposed to happen at each level through the inheritance chain. So
a DDProxy implentation will execute apply config on DDProxy, DD, and
DragDrop in order to get all of the parameters that are available in
each object.
Configures the padding for the target zone in px. Effectively expands
(or reduces) the virtual object size for targeting calculations.
Supports css-style shorthand; if only one parameter is passed, all sides
will have that padding, and if only two are passed, the top and bottom
will have the first param, the left and right the second.
Top pad
Right pad
Bot pad
Left pad
Stores the initial placement of the linked element.
the X offset, default 0
the Y offset, default 0
Add this instance to a group of related drag/drop objects. All
instances belong to at least one group, and can belong to as many
groups as needed.
the name of the group
Remove's this instance from the supplied interaction group
The group to drop
Allows you to specify that an element other than the linked element
will be moved with the cursor during a drag
the id of the element that will be used to initiate the drag
Allows you to specify a child of the linked element that should be
used to initiate the drag operation. An example of this would be if
you have a content div with text and links. Clicking anywhere in the
content area would normally start the drag operation. Use this method
to specify that an element inside of the content div is the element
that starts the drag operation.
the id of the element that will be used to
initiate the drag.
Allows you to set an element outside of the linked element as a drag
handle
id of the element that will be used to initiate the drag
Remove all drag and drop hooks for this element
Returns true if this instance is locked, or the drag drop mgr is locked
(meaning that all drag/drop is disabled on the page.)
Allows you to specify a tag name that should not start a drag operation
when clicked. This is designed to facilitate embedding links within a
drag handle that do something other than start the drag.
the type of element to exclude
Lets you to specify an element id for a child of a drag handle
that should not initiate a drag
the element id of the element you wish to ignore
Lets you specify a css class of elements that will not initiate a drag
the class of the elements you wish to ignore
Unsets an excluded tag name set by addInvalidHandleType
the type of element to unexclude
Unsets an invalid handle id
the id of the element to re-enable
Unsets an invalid css class
the class of the element(s) you wish to
re-enable
Checks the tag exclusion list to see if this click should be ignored
the HTMLElement to evaluate
By default, the element can be dragged any place on the screen. Use
this method to limit the horizontal travel of the element. Pass in
0,0 for the parameters if you want to lock the drag to the y axis.
the number of pixels the element can move to the left
the number of pixels the element can move to the
right
optional parameter for specifying that the
element
should move iTickSize pixels at a time.
Clears any constraints applied to this instance. Also clears ticks
since they can't exist independent of a constraint at this time.
Clears any tick interval defined for this instance
By default, the element can be dragged any place on the screen. Set
this to limit the vertical travel of the element. Pass in 0,0 for the
parameters if you want to lock the drag to the x axis.
the number of pixels the element can move up
the number of pixels the element can move down
optional parameter for specifying that the
element should move iTickSize pixels at a time.
resetConstraints must be called if you manually reposition a dd element.
toString method
DragDropMgr is a singleton that tracks the element interaction for
all DragDrop items in the window. Generally, you will not call
this class directly, but it does have helper methods that could
be useful in your DragDrop implementations.<br><br><i>This class is a singleton and cannot be created directly.</i>
<static> Flag to determine if we should prevent the default behavior of the
events we define. By default this is true, but this can be set to
false if you need the default behavior (not recommended)
<static> Flag to determine if we should stop the propagation of the events
we generate. This is true by default but you may want to set it to
false if the html element contains other features that require the
mouse click.
<static> In point mode, drag and drop interaction is defined by the
location of the cursor during the drag/drop
<static> In intersect mode, drag and drop interaction is defined by the
overlap of two or more drag and drop objects.
<static> The current drag and drop mode. Default: POINT
<static> Set useCache to false if you want to force object the lookup of each
drag and drop linked element constantly during a drag.
<static> The number of pixels that the mouse needs to move after the
mousedown before the drag is initiated. Default=3;
<static> The number of milliseconds after the mousedown event to initiate the
drag if we don't get a mouseup event. Default=1000
The element
The element id
A reference to the style property
<static> Lock all drag and drop functionality
<static> Unlock all drag and drop functionality
<static> Is drag and drop locked?
<static> Each DragDrop instance must be registered with the DragDropMgr.
This is executed in DragDrop.init()
the DragDrop object to register
the name of the group this element belongs to
<static> Each DragDrop handle element must be registered. This is done
automatically when executing DragDrop.setHandleElId()
the DragDrop id this element is a handle for
the id of the element that is the drag
handle
<static> Utility function to determine if a given element has been
registered as a drag drop item.
the element id to check
<static> Returns the drag and drop instances that are in all groups the
passed in instance belongs to.
the obj to get related data for
if true, only return targetable objs
<static> Returns true if the specified dd target is a legal target for
the specifice drag obj
drag obj
target
<static> My goal is to be able to transparently determine if an object is
typeof DragDrop, and the exact subclass of DragDrop. typeof
returns "object", oDD.constructor.toString() always returns
"DragDrop" and not the name of the subclass. So for now it just
evaluates a well-known variable in DragDrop.
object to evaluate
<static> Utility function to determine if a given element has been
registered as a drag drop handle for the given Drag Drop object.
the element id to check
<static> Returns the DragDrop instance for a given id
the id of the DragDrop object
<static> Fired when either the drag pixel threshol or the mousedown hold
time threshold has been met.
the X position of the original mousedown
the Y position of the original mousedown
<static> Utility to stop event propagation and event default, if these
features are turned on.
the event as returned by this.getEvent()
<static> Helper function for getting the best match from the list of drag
and drop objects returned by the drag and drop events when we are
in INTERSECT mode. It returns either the first object that the
cursor is over, or the object that has the greatest overlap with
the dragged element.
The array of drag and drop objects
targeted
<static> Refreshes the cache of the top-left and bottom-right points of the
drag and drop objects in the specified group(s). This is in the
format that is stored in the drag and drop instance, so typical
usage is:
<code>
apf.dd.DragDropMgr.refreshCache(ddinstance.groups);
</code>
Alternatively:
<code>
apf.dd.DragDropMgr.refreshCache({group1:true, group2:true});
</code>
@TODO this really should be an indexed array. Alternatively this
method could accept both.
an associative array of groups to refresh
<static> This checks to make sure an element exists and is in the DOM. The
main purpose is to handle cases where innerHTML is used to remove
drag and drop objects from the DOM. IE provides an 'unspecified
error' when trying to access the offsetParent of such an element
the element to check
<static> Returns a Region object containing the drag and drop element's position
and size, including the padding configured for it
the drag and drop object to get the
location for
<b>Deprecated.</b> <static> Returns the actual DOM element
the id of the elment to get
<b>Deprecated.</b> <static> Returns the style property for the DOM element (i.e.,
document.getElById(id).style)
the id of the elment to get
<b>Deprecated.</b> <static> Returns the X position of an html element
element for which to get the position
<b>Deprecated.</b> <static> Returns the Y position of an html element
element for which to get the position
<static> Swap two nodes. In IE, we use the native method, for others we
emulate the IE behavior
first node to swap
other node to swap
<b>Deprecated.</b> <static> Returns the specified element style property
the element
the style property
<static> Gets the scrollTop
<static> Gets the scrollLeft
<static> Sets the x/y position of an element to the location of the
target element.
The element to move
The position reference element
<static> Numeric array sort function
<static> Recursively searches the immediate parent and all child nodes for
the handle element in order to determine wheter or not it was
clicked.
html element to inspect
A simple class that provides the basic implementation needed to make any element draggable.
The container element
An empty function by default, but provided so that you can perform a custom action once the initial
drag event has begun. The drag cannot be canceled from this function.
Returns the data object associated with this drag source
An empty function by default, but provided so that you can perform a custom action
when the dragged item enters the drop target by providing an implementation.
The drop target
The event object
The id of the dragged element
An empty function by default, but provided so that you can perform a custom action
before the dragged item enters the drop target and optionally cancel the onDragEnter.
The drop target
The event object
The id of the dragged element
An empty function by default, but provided so that you can perform a custom action
while the dragged item is over the drop target by providing an implementation.
The drop target
The event object
The id of the dragged element
An empty function by default, but provided so that you can perform a custom action
while the dragged item is over the drop target and optionally cancel the onDragOver.
The drop target
The event object
The id of the dragged element
An empty function by default, but provided so that you can perform a custom action
after the dragged item is dragged out of the target without dropping.
The drop target
The event object
The id of the dragged element
An empty function by default, but provided so that you can perform a custom action before the dragged
item is dragged out of the target without dropping, and optionally cancel the onDragOut.
The drop target
The event object
The id of the dragged element
An empty function by default, but provided so that you can perform a custom action
after a valid drag drop has occurred by providing an implementation.
The drop target
The event object
The id of the dropped element
An empty function by default, but provided so that you can perform a custom action before the dragged
item is dropped onto the target and optionally cancel the onDragDrop.
The drop target
The event object
The id of the dragged element
An empty function by default, but provided so that you can perform a custom action
after an invalid drop has occurred by providing an implementation.
The event object
The id of the dropped element
An empty function by default, but provided so that you can perform a custom action after an invalid
drop has occurred.
The drop target
The event object
The id of the dragged element
An empty function by default, but provided so that you can perform a custom action before the initial
drag event begins and optionally cancel it.
An object containing arbitrary data to be shared with drop targets
The event object
Returns the drag source's underlying <a ext:cls="apf.dd.StatusProxy" href="output/apf.dd.StatusProxy.html">apf.dd.StatusProxy</a>
Hides the drag source's <a ext:cls="apf.dd.StatusProxy" href="output/apf.dd.StatusProxy.html">apf.dd.StatusProxy</a>
This class provides a container DD instance that proxies for multiple child node sources.<br />
By default, this class requires that draggable child nodes are registered with <a ext:cls="apf.dd.Registry" href="output/apf.dd.Registry.html">apf.dd.Registry</a>.
The container element
Called when a mousedown occurs in this container. Looks in <a ext:cls="apf.dd.Registry" href="output/apf.dd.Registry.html">apf.dd.Registry</a>
for a valid target to drag based on the mouse down. Override this method
to provide your own lookup logic (e.g. finding a child by class name). Make sure your returned
object has a "ddel" attribute (with an HTML Element) for other functions to work.
The mouse down event
Called once drag threshold has been reached to initialize the proxy element. By default, it clones the
this.dragData.ddel
The x position of the click on the dragged object
The y position of the click on the dragged object
Called after a repair of an invalid drop. By default, highlights this.dragData.ddel
Called before a repair of an invalid drop to get the XY to animate to. By default returns
the XY of this.dragData.ddel
The mouse up event
A simple class that provides the basic implementation needed to make any element a drop target that can have
draggable items dropped onto it. The drop has no effect until an implementation of notifyDrop is provided.
The container element
The function a <a ext:cls="apf.dd.DragSource" href="output/apf.dd.DragSource.html">apf.dd.DragSource</a> calls once to notify this drop target that the source is now over the
target. This default implementation adds the CSS class specified by overClass (if any) to the drop element
and returns the dropAllowed config value. This method should be overridden if drop validation is required.
The drag source that was dragged over this drop target
The event
An object containing arbitrary data supplied by the drag source
The function a <a ext:cls="apf.dd.DragSource" href="output/apf.dd.DragSource.html">apf.dd.DragSource</a> calls continuously while it is being dragged over the target.
This method will be called on every mouse movement while the drag source is over the drop target.
This default implementation simply returns the dropAllowed config value.
The drag source that was dragged over this drop target
The event
An object containing arbitrary data supplied by the drag source
The function a <a ext:cls="apf.dd.DragSource" href="output/apf.dd.DragSource.html">apf.dd.DragSource</a> calls once to notify this drop target that the source has been dragged
out of the target without dropping. This default implementation simply removes the CSS class specified by
overClass (if any) from the drop element.
The drag source that was dragged over this drop target
The event
An object containing arbitrary data supplied by the drag source
The function a <a ext:cls="apf.dd.DragSource" href="output/apf.dd.DragSource.html">apf.dd.DragSource</a> calls once to notify this drop target that the dragged item has
been dropped on it. This method has no default implementation and returns false, so you must provide an
implementation that does something to process the drop event and returns true so that the drag source's
repair action does not run.
The drag source that was dragged over this drop target
The event
An object containing arbitrary data supplied by the drag source
This class provides a container DD instance that proxies for multiple child node targets.<br />
By default, this class requires that child nodes accepting drop are registered with <a ext:cls="apf.dd.Registry" href="output/apf.dd.Registry.html">apf.dd.Registry</a>.
The container element
Returns a custom data object associated with the DOM node that is the target of the event. By default
this looks up the event target in the <a ext:cls="apf.dd.Registry" href="output/apf.dd.Registry.html">apf.dd.Registry</a>, although you can override this method to
provide your own custom lookup.
The event
Called internally when the DropZone determines that a <a ext:cls="apf.dd.DragSource" href="output/apf.dd.DragSource.html">apf.dd.DragSource</a> has entered a drop node
that it has registered. This method has no default implementation and should be overridden to provide
node-specific processing if necessary.
The custom data associated with the drop node (this is the same value returned from
<a ext:cls="apf.dd.DropZone" ext:member="getTargetFromEvent" href="output/apf.dd.DropZone.html#getTargetFromEvent">getTargetFromEvent</a> for this node)
The drag source that was dragged over this drop zone
The event
An object containing arbitrary data supplied by the drag source
Called internally while the DropZone determines that a <a ext:cls="apf.dd.DragSource" href="output/apf.dd.DragSource.html">apf.dd.DragSource</a> is over a drop node
that it has registered. The default implementation returns this.dropNotAllowed, so it should be
overridden to provide the proper feedback.
The custom data associated with the drop node (this is the same value returned from
<a ext:cls="apf.dd.DropZone" ext:member="getTargetFromEvent" href="output/apf.dd.DropZone.html#getTargetFromEvent">getTargetFromEvent</a> for this node)
The drag source that was dragged over this drop zone
The event
An object containing arbitrary data supplied by the drag source
Called internally when the DropZone determines that a <a ext:cls="apf.dd.DragSource" href="output/apf.dd.DragSource.html">apf.dd.DragSource</a> has been dragged out of
the drop node without dropping. This method has no default implementation and should be overridden to provide
node-specific processing if necessary.
The custom data associated with the drop node (this is the same value returned from
<a ext:cls="apf.dd.DropZone" ext:member="getTargetFromEvent" href="output/apf.dd.DropZone.html#getTargetFromEvent">getTargetFromEvent</a> for this node)
The drag source that was dragged over this drop zone
The event
An object containing arbitrary data supplied by the drag source
Called internally when the DropZone determines that a <a ext:cls="apf.dd.DragSource" href="output/apf.dd.DragSource.html">apf.dd.DragSource</a> has been dropped onto
the drop node. The default implementation returns false, so it should be overridden to provide the
appropriate processing of the drop event and return true so that the drag source's repair action does not run.
The custom data associated with the drop node (this is the same value returned from
<a ext:cls="apf.dd.DropZone" ext:member="getTargetFromEvent" href="output/apf.dd.DropZone.html#getTargetFromEvent">getTargetFromEvent</a> for this node)
The drag source that was dragged over this drop zone
The event
An object containing arbitrary data supplied by the drag source
Called internally while the DropZone determines that a <a ext:cls="apf.dd.DragSource" href="output/apf.dd.DragSource.html">apf.dd.DragSource</a> is being dragged over it,
but not over any of its registered drop nodes. The default implementation returns this.dropNotAllowed, so
it should be overridden to provide the proper feedback if necessary.
The drag source that was dragged over this drop zone
The event
An object containing arbitrary data supplied by the drag source
Called internally when the DropZone determines that a <a ext:cls="apf.dd.DragSource" href="output/apf.dd.DragSource.html">apf.dd.DragSource</a> has been dropped on it,
but not on any of its registered drop nodes. The default implementation returns false, so it should be
overridden to provide the appropriate processing of the drop event if you need the drop zone itself to
be able to accept drops. It should return true when valid so that the drag source's repair action does not run.
The drag source that was dragged over this drop zone
The event
An object containing arbitrary data supplied by the drag source
The function a <a ext:cls="apf.dd.DragSource" href="output/apf.dd.DragSource.html">apf.dd.DragSource</a> calls once to notify this drop zone that the source is now over
the zone. The default implementation returns this.dropNotAllowed and expects that only registered drop
nodes can process drag drop operations, so if you need the drop zone itself to be able to process drops
you should override this method and provide a custom implementation.
The drag source that was dragged over this drop zone
The event
An object containing arbitrary data supplied by the drag source
The function a <a ext:cls="apf.dd.DragSource" href="output/apf.dd.DragSource.html">apf.dd.DragSource</a> calls continuously while it is being dragged over the drop zone.
This method will be called on every mouse movement while the drag source is over the drop zone.
It will call <a ext:cls="apf.dd.DropZone" ext:member="onNodeOver" href="output/apf.dd.DropZone.html#onNodeOver">onNodeOver</a> while the drag source is over a registered node, and will also automatically
delegate to the appropriate node-specific methods as necessary when the drag source enters and exits
registered nodes (<a ext:cls="apf.dd.DropZone" ext:member="onNodeEnter" href="output/apf.dd.DropZone.html#onNodeEnter">onNodeEnter</a>, <a ext:cls="apf.dd.DropZone" ext:member="onNodeOut" href="output/apf.dd.DropZone.html#onNodeOut">onNodeOut</a>). If the drag source is not currently over a
registered node, it will call <a ext:cls="apf.dd.DropZone" ext:member="onContainerOver" href="output/apf.dd.DropZone.html#onContainerOver">onContainerOver</a>.
The drag source that was dragged over this drop zone
The event
An object containing arbitrary data supplied by the drag source
The function a <a ext:cls="apf.dd.DragSource" href="output/apf.dd.DragSource.html">apf.dd.DragSource</a> calls once to notify this drop zone that the source has been dragged
out of the zone without dropping. If the drag source is currently over a registered node, the notification
will be delegated to <a ext:cls="apf.dd.DropZone" ext:member="onNodeOut" href="output/apf.dd.DropZone.html#onNodeOut">onNodeOut</a> for node-specific handling, otherwise it will be ignored.
The drag source that was dragged over this drop target
The event
An object containing arbitrary data supplied by the drag zone
The function a <a ext:cls="apf.dd.DragSource" href="output/apf.dd.DragSource.html">apf.dd.DragSource</a> calls once to notify this drop zone that the dragged item has
been dropped on it. The drag zone will look up the target node based on the event passed in, and if there
is a node registered for that event, it will delegate to <a ext:cls="apf.dd.DropZone" ext:member="onNodeDrop" href="output/apf.dd.DropZone.html#onNodeDrop">onNodeDrop</a> for node-specific handling,
otherwise it will call <a ext:cls="apf.dd.DropZone" ext:member="onContainerDrop" href="output/apf.dd.DropZone.html#onContainerDrop">onContainerDrop</a>.
The drag source that was dragged over this drop zone
The event
An object containing arbitrary data supplied by the drag source
Provides easy access to all drag drop components that are registered on a page. Items can be retrieved either
directly by DOM node id, or by passing in the drag drop event that occurred and looking up the event target.<br><br><i>This class is a singleton and cannot be created directly.</i>
Resgister a drag drop element
The id or DOM node to register
(optional) An custom data object that will be passed between the elements that are involved
in drag drop operations. You can populate this object with any arbitrary properties that your own code
knows how to interpret, plus there are some specific properties known to the Registry that should be
populated in the data object (if applicable):
<pre>Value Description<br />
--------- ------------------------------------------<br />
handles Array of DOM nodes that trigger dragging<br />
for the element being registered<br />
isHandle True if the element passed in triggers<br />
dragging itself, else false</pre>
Unregister a drag drop element
The id or DOM node to unregister
Returns the handle registered for a DOM Node by id
The DOM node or id to look up
Returns the handle that is registered for the DOM node that is the target of the event
The event
Returns a custom data object that is registered for a DOM node by id
The DOM node or id to look up
Returns a custom data object that is registered for the DOM node that is the target of the event
The event
<p>Provides automatic scrolling of overflow regions in the page during drag operations.</p>
<p>The ScrollManager configs will be used as the defaults for any scroll container registered with it,
but you can also override most of the configs per scroll container by adding a
<tt>ddScrollConfig</tt> object to the target element that contains these properties: <a ext:cls="apf.dd.ScrollManager" ext:member="hthresh" href="output/apf.dd.ScrollManager.html#hthresh">hthresh</a>,
<a ext:cls="apf.dd.ScrollManager" ext:member="vthresh" href="output/apf.dd.ScrollManager.html#vthresh">vthresh</a>, <a ext:cls="apf.dd.ScrollManager" ext:member="increment" href="output/apf.dd.ScrollManager.html#increment">increment</a> and <a ext:cls="apf.dd.ScrollManager" ext:member="frequency" href="output/apf.dd.ScrollManager.html#frequency">frequency</a>. Example usage:
<pre><code>var el = apf.get('scroll-ct');
el.ddScrollConfig = {
vthresh: 50,
hthresh: -1,
frequency: 100,
increment: 200
};
apf.dd.ScrollManager.register(el);</code></pre>
<b>Note: This class uses "Point Mode" and is untested in "Intersect Mode".</b><br><br><i>This class is a singleton and cannot be created directly.</i>
The number of pixels from the top or bottom edge of a container the pointer needs to be to
trigger scrolling (defaults to 25)
The number of pixels from the right or left edge of a container the pointer needs to be to
trigger scrolling (defaults to 25)
The number of pixels to scroll in each scroll increment (defaults to 50)
The frequency of scrolls in milliseconds (defaults to 500)
True to animate the scroll (defaults to true)
The animation duration in seconds -
MUST BE less than apf.dd.ScrollManager.frequency! (defaults to .4)
Registers new overflow element(s) to auto scroll
The id of or the element to be scrolled or an array of either
Unregisters overflow element(s) so they are no longer scrolled
The id of or the element to be removed or an array of either
Manually trigger a cache refresh.
A specialized drag proxy that supports a drop status icon, <a ext:cls="apf.Layer" href="output/apf.Layer.html">apf.Layer</a> styles and auto-repair. This is the
default drag proxy used by all apf.dd components.
Updates the proxy's visual element to indicate the status of whether or not drop is allowed
over the current target element.
The css class for the new drop status indicator image
Resets the status indicator to the default dropNotAllowed value
True to also remove all content from the ghost, false to preserve it
Updates the contents of the ghost element
The html that will replace the current innerHTML of the ghost element, or a
DOM node to append as the child of the ghost element (in which case the innerHTML will be cleared first).
Returns the underlying proxy <a ext:cls="apf.Layer" href="output/apf.Layer.html">apf.Layer</a>
Returns the ghost element
Hides the proxy
True to reset the status and clear the ghost contents, false to preserve them
Stops the repair animation if it's currently running
Displays this proxy
Force the Layer to sync its shadow and shim positions to the element
Causes the proxy to return to its position of origin via an animation. Should be called after an
invalid drop operation by the item being dragged.
The XY position of the element ([x, y])
The function to call after the repair is complete
The scope in which to execute the callback
<p>The subclasses of this class provide actions to perform upon <a ext:cls="apf.form.BasicForm" href="output/apf.form.BasicForm.html">Form</a>s.</p>
<p>Instances of this class are only created by a <a ext:cls="apf.form.BasicForm" href="output/apf.form.BasicForm.html">Form</a> when
the Form needs to perform an action such as submit or load. The Configuration options
listed for this class are set through the Form's action methods: <a ext:cls="apf.form.BasicForm" ext:member="submit" href="output/apf.form.BasicForm.html#submit">submit</a>,
<a ext:cls="apf.form.BasicForm" ext:member="load" href="output/apf.form.BasicForm.html#load">load</a> and <a ext:cls="apf.form.BasicForm" ext:member="doAction" href="output/apf.form.BasicForm.html#doAction">doAction</a></p>
<p>The instance of Action which performed the action is passed to the success
and failure callbacks of the Form's action methods (<a ext:cls="apf.form.BasicForm" ext:member="submit" href="output/apf.form.BasicForm.html#submit">submit</a>,
<a ext:cls="apf.form.BasicForm" ext:member="load" href="output/apf.form.BasicForm.html#load">load</a> and <a ext:cls="apf.form.BasicForm" ext:member="doAction" href="output/apf.form.BasicForm.html#doAction">doAction</a>),
and to the <a ext:cls="apf.form.BasicForm" ext:member="actioncomplete" href="output/apf.form.BasicForm.html#actioncomplete">actioncomplete</a> and
<a ext:cls="apf.form.BasicForm" ext:member="actionfailed" href="output/apf.form.BasicForm.html#actionfailed">actionfailed</a> event handlers.</p>
<static> Failure type returned when client side validation of the Form fails
thus aborting a submit action.
<static> Failure type returned when server side validation of the Form fails
indicating that field-specific error messages have been returned in the
response's <tt style="font-weight:bold">errors</tt> property.
<static> Failure type returned when a communication error happens when attempting
to send a request to the remote server.
<static> Failure type returned when no field values are returned in the response's
<tt style="font-weight:bold">data</tt> property.
The type of action this Action instance performs.
Currently only "submit" and "load" are supported.
The type of failure detected. See <a ext:cls="apf.form.Action" ext:member="apf.form.Action.CLIENT_INVALID" href="output/apf.form.Action.html#apf.form.Action.CLIENT_INVALID">CLIENT_INVALID</a>, <a ext:cls="apf.form.Action" ext:member="apf.form.Action.SERVER_INVALID" href="output/apf.form.Action.html#apf.form.Action.SERVER_INVALID">SERVER_INVALID</a>,
<a ext:cls="apf.form.Action" ext:member="apf.form.Action.CONNECT_FAILURE" href="output/apf.form.Action.html#apf.form.Action.CONNECT_FAILURE">CONNECT_FAILURE</a>, <a ext:cls="apf.form.Action" ext:member="apf.form.Action.LOAD_FAILURE" href="output/apf.form.Action.html#apf.form.Action.LOAD_FAILURE">LOAD_FAILURE</a>
The XMLHttpRequest object used to perform the action.
The decoded response object containing a boolean <tt style="font-weight:bold">success</tt> property and
other, action-specific properties.
<p>A class which handles loading of data from a server into the Fields of an <a ext:cls="apf.form.BasicForm" href="output/apf.form.BasicForm.html">apf.form.BasicForm</a>.</p>
<p>Instances of this class are only created by a <a ext:cls="apf.form.BasicForm" href="output/apf.form.BasicForm.html">Form</a> when
<a ext:cls="apf.form.BasicForm" ext:member="load" href="output/apf.form.BasicForm.html#load">load</a>ing.</p>
<p>A response packet <b>must</b> contain a boolean <tt style="font-weight:bold">success</tt> property, and
a <tt style="font-weight:bold">data</tt> property. The <tt style="font-weight:bold">data</tt> property
contains the values of Fields to load. The individual value object for each Field
is passed to the Field's <a ext:cls="apf.form.Field" ext:member="setValue" href="output/apf.form.Field.html#setValue">setValue</a> method.</p>
<p>By default, response packets are assumed to be JSON, so a typical response
packet may look like this:</p><pre><code>{
success: true,
data: {
clientName: "Fred. Olsen Lines",
portOfLoading: "FXT",
portOfDischarge: "OSL"
}
}</code></pre>
<p>Other data may be placed into the response for processing the <a ext:cls="apf.form.BasicForm" href="output/apf.form.BasicForm.html">Form</a>'s callback
or event handler methods. The object decoded from this JSON is available in the <a ext:cls="apf.form.Action.Load" ext:member="result" href="output/apf.form.Action.Load.html#result">result</a> property.</p>
<p>A class which handles submission of data from <a ext:cls="apf.form.BasicForm" href="output/apf.form.BasicForm.html">Form</a>s
and processes the returned response.</p>
<p>Instances of this class are only created by a <a ext:cls="apf.form.BasicForm" href="output/apf.form.BasicForm.html">Form</a> when
<a ext:cls="apf.form.BasicForm" ext:member="submit" href="output/apf.form.BasicForm.html#submit">submit</a>ting.</p>
<p>A response packet must contain a boolean <tt style="font-weight:bold">success</tt> property, and, optionally
an <tt style="font-weight:bold">errors</tt> property. The <tt style="font-weight:bold">errors</tt> property contains error
messages for invalid fields.</p>
<p>By default, response packets are assumed to be JSON, so a typical response
packet may look like this:</p><pre><code>{
success: false,
errors: {
clientCode: "Client not found",
portOfLoading: "This field must not be null"
}
}</code></pre>
<p>Other data may be placed into the response for processing by the <a ext:cls="apf.form.BasicForm" href="output/apf.form.BasicForm.html">apf.form.BasicForm</a>'s callback
or event handler methods. The object decoded from this JSON is available in the <a ext:cls="apf.form.Action.Submit" ext:member="result" href="output/apf.form.Action.Submit.html#result">result</a> property.</p>
<p>Alternatively, if an <a ext:cls="apf.form.Action.Submit" ext:member="errorReader" href="output/apf.form.Action.Submit.html#errorReader">errorReader</a> is specified as an <a ext:cls="apf.data.XmlReader" href="output/apf.data.XmlReader.html">XmlReader</a>:</p><pre><code>errorReader: new apf.data.XmlReader({
record : 'field',
success: '@success'
}, [
'id', 'msg'
]
)</code></pre>
<p>then the results may be sent back in XML format:</p><pre><code><?xml version="1.0" encoding="UTF-8"?>
<message success="false">
<errors>
<field>
<id>clientCode</id>
<msg><![CDATA[Code not found. <br /><i>This is a test validation message from the server </i>]]></msg>
</field>
<field>
<id>portOfLoading</id>
<msg><![CDATA[Port not found. <br /><i>This is a test validation message from the server </i>]]></msg>
</field>
</errors>
</message></code></pre>
<p>Other elements may be placed into the response XML for processing by the <a ext:cls="apf.form.BasicForm" href="output/apf.form.BasicForm.html">apf.form.BasicForm</a>'s callback
or event handler methods. The XML document is available in the <a ext:cls="apf.form.Action.Submit" ext:member="errorReader" href="output/apf.form.Action.Submit.html#errorReader">errorReader</a>'s <a ext:cls="apf.data.XmlReader" ext:member="xmlData" href="output/apf.data.XmlReader.html#xmlData">xmlData</a> property.</p>
Supplies the functionality to do "actions" on forms and initialize apf.form.Field types on existing markup.
<br><br>
By default, apf Forms are submitted through Ajax, using <a ext:cls="apf.form.Action" href="output/apf.form.Action.html">apf.form.Action</a>.
To enable normal browser submission of an apf Form, use the <a ext:cls="apf.form.BasicForm" ext:member="standardSubmit" href="output/apf.form.BasicForm.html#standardSubmit">standardSubmit</a> config option.
The form element or its id
Configuration options
By default wait messages are displayed with apf.MessageBox.wait. You can target a specific
element by passing it or its id or mask the form itself by passing in true.
Get the HTML form Element
Returns true if client-side validation on the form is successful.
Returns true if any fields in this form have changed since their original load.
Performs a predefined action (<a ext:cls="apf.form.Action.Submit" href="output/apf.form.Action.Submit.html">apf.form.Action.Submit</a> or
<a ext:cls="apf.form.Action.Load" href="output/apf.form.Action.Load.html">apf.form.Action.Load</a>) or a custom extension of <a ext:cls="apf.form.Action" href="output/apf.form.Action.html">apf.form.Action</a>
to perform application-specific processing.
The name of the predefined action type,
or instance of <a ext:cls="apf.form.Action" href="output/apf.form.Action.html">apf.form.Action</a> to perform.
(optional) The options to pass to the <a ext:cls="apf.form.Action" href="output/apf.form.Action.html">apf.form.Action</a>.
All of the config options listed below are supported by both the submit
and load actions unless otherwise noted (custom actions could also accept
other config options):<ul>
<li><b>url</b> : String<p style="margin-left:1em">The url for the action (defaults
to the form's url.)</p></li>
<li><b>method</b> : String<p style="margin-left:1em">The form method to use (defaults
to the form's method, or POST if not defined)</p></li>
<li><b>params</b> : String/Object<p style="margin-left:1em">The params to pass
(defaults to the form's baseParams, or none if not defined)</p></li>
<li><b>headers</b> : Object<p style="margin-left:1em">Request headers to set for the action
(defaults to the form's default headers)</p></li>
<li><b>success</b> : Function<p style="margin-left:1em">The callback that will
be invoked after a successful response. Note that this is HTTP success
(the transaction was sent and received correctly), but the resulting response data
can still contain data errors. The function is passed the following parameters:<ul>
<li><code>form</code> : apf.form.BasicForm<div class="sub-desc">The form that requested the action</div></li>
<li><code>action</code> : apf.form.Action<div class="sub-desc">The Action class. The <a ext:cls="apf.form.Action" ext:member="result" href="output/apf.form.Action.html#result">result</a>
property of this object may be examined to perform custom postprocessing.</div></li>
</ul></p></li>
<li><b>failure</b> : Function<p style="margin-left:1em">The callback that will
be invoked after a failed transaction attempt. Note that this is HTTP failure,
which means a non-successful HTTP code was returned from the server. The function
is passed the following parameters:<ul>
<li><code>form</code> : apf.form.BasicForm<div class="sub-desc">The form that requested the action</div></li>
<li><code>action</code> : apf.form.Action<div class="sub-desc">The Action class. If an Ajax
error ocurred, the failure type will be in <a ext:cls="apf.form.Action" ext:member="failureType" href="output/apf.form.Action.html#failureType">failureType</a>. The <a ext:cls="apf.form.Action" ext:member="result" href="output/apf.form.Action.html#result">result</a>
property of this object may be examined to perform custom postprocessing.</div></li>
</ul></p></li>
<li><b>scope</b> : Object<p style="margin-left:1em">The scope in which to call the
callback functions (The <tt>this</tt> reference for the callback functions).</p></li>
<li><b>clientValidation</b> : Boolean<p style="margin-left:1em">Submit Action only.
Determines whether a Form's fields are validated in a final call to
<a ext:cls="apf.form.BasicForm" ext:member="isValid" href="output/apf.form.BasicForm.html#isValid">isValid</a> prior to submission. Set to <tt>false</tt>
to prevent this. If undefined, pre-submission field validation is performed.</p></li></ul>
Shortcut to do a submit action.
The options to pass to the action (see <a ext:cls="apf.form.BasicForm" ext:member="doAction" href="output/apf.form.BasicForm.html#doAction">doAction</a> for details)
Shortcut to do a load action.
The options to pass to the action (see <a ext:cls="apf.form.BasicForm" ext:member="doAction" href="output/apf.form.BasicForm.html#doAction">doAction</a> for details)
Persists the values in this form into the passed apf.data.Record object in a beginEdit/endEdit block.
The record to edit
Loads an apf.data.Record into this form.
The record to load
Find a apf.form.Field in this form by id, dataIndex, name or hiddenName.
The value to search for
Mark fields in this form invalid in bulk.
Either an array in the form [{id:'fieldId', msg:'The message'},...] or an object hash of {id: msg, id2: msg2}
Set values for fields in this form in bulk.
Either an array in the form:<br><br><code><pre>[{id:'clientName', value:'Fred. Olsen Lines'},
{id:'portOfLoading', value:'FXT'},
{id:'portOfDischarge', value:'OSL'} ]</pre></code><br><br>
or an object hash of the form:<br><br><code><pre>{
clientName: 'Fred. Olsen Lines',
portOfLoading: 'FXT',
portOfDischarge: 'OSL'
}</pre></code><br>
Returns the fields in this form as an object with key/value pairs as they would be submitted using a standard form submit.
If multiple fields exist with the same name they are returned as an array.
(optional) false to return the values as an object (defaults to returning as a string)
Clears all invalid messages in this form.
Resets this form.
Add apf.form components to this form.
(optional)
(optional)
Removes a field from the items collection (does NOT remove its markup).
Iterates through the <a ext:cls="apf.form.Field" href="output/apf.form.Field.html">Field</a>s which have been <a ext:cls="apf.form.BasicForm" ext:member="add" href="output/apf.form.BasicForm.html#add">add</a>ed to this BasicForm,
checks them for an id attribute, and calls <a ext:cls="apf.form.Field" ext:member="applyToMarkup" href="output/apf.form.Field.html#applyToMarkup">apf.form.Field.applyToMarkup</a> on the existing dom element with that id.
Calls <a ext:cls="apf" ext:member="apply" href="output/apf.html#apply">apf.apply</a> for all fields in this form with the passed object.
Calls <a ext:cls="apf" ext:member="applyIf" href="output/apf.html#applyIf">apf.applyIf</a> for all field in this form with the passed object.
Single checkbox field. Can be used as a direct replacement for traditional checkbox fields.
Creates a new Checkbox
Configuration options
Overridden and disabled. The editor element does not support standard valid/invalid marking. @hide
Overridden and disabled. The editor element does not support standard valid/invalid marking. @hide
Returns the checked state of the checkbox.
Sets the checked state of the checkbox.
True, 'true', '1', or 'on' to check the checkbox, any other value will uncheck it.
A grouping container for <a ext:cls="apf.form.Checkbox" href="output/apf.form.Checkbox.html">apf.form.Checkbox</a> controls.
Creates a new CheckboxGroup
Configuration options
@hide
@hide
@hide
@hide
@hide
A combobox control with support for autocomplete, remote-loading, paging and many other features.
Create a new ComboBox.
Configuration options
The <a ext:cls="apf.DataView" href="output/apf.DataView.html">DataView</a> used to display the ComboBox's options.
Allow or prevent the user from directly editing the field text. If false is passed,
the user will only be able to select from the items defined in the dropdown list. This method
is the runtime equivalent of setting the 'editable' config option at config time.
True to allow the user to directly edit the field text
Returns the currently selected field value or empty string if no value is set.
Clears any text/value currently set in the field
Sets the specified value into the field. If the value finds a match, the corresponding record text
will be displayed in the field. If the value does not match the data value of an existing item,
and the valueNotFoundText config option is defined, it will be displayed as the default field text.
Otherwise the field will be blank (although the value will still be set).
The value to match
Returns true if the dropdown list is expanded, else false.
Select an item in the dropdown list by its data value. This function does NOT cause the select event to fire.
The store must be loaded and the list expanded for this function to work, otherwise use setValue.
The data value of the item to select
False to prevent the dropdown list from autoscrolling to display the
selected item if it is not currently in view (defaults to true)
Select an item in the dropdown list by its numeric index in the list. This function does NOT cause the select event to fire.
The store must be loaded and the list expanded for this function to work, otherwise use setValue.
The zero-based index of the list item to select
False to prevent the dropdown list from autoscrolling to display the
selected item if it is not currently in view (defaults to true)
Execute a query to filter the dropdown list. Fires the <a ext:cls="apf.form.ComboBox" ext:member="beforequery" href="output/apf.form.ComboBox.html#beforequery">beforequery</a> event prior to performing the
query allowing the query action to be canceled if needed.
The SQL query to execute
True to force the query to execute even if there are currently fewer characters
in the field than the minimum specified by the minChars config option. It also clears any filter previously
saved in the current store (defaults to false)
Hides the dropdown list if it is currently expanded. Fires the <a ext:cls="apf.form.ComboBox" ext:member="collapse" href="output/apf.form.ComboBox.html#collapse">collapse</a> event on completion.
Expands the dropdown list if it is currently hidden. Fires the <a ext:cls="apf.form.ComboBox" ext:member="expand" href="output/apf.form.ComboBox.html#expand">expand</a> event on completion.
@hide
@hide
Provides a date input field with a <a ext:cls="apf.DatePicker" href="output/apf.DatePicker.html">apf.DatePicker</a> dropdown and automatic date validation.
Create a new DateField
Replaces any existing disabled dates with new values and refreshes the DatePicker.
An array of date strings (see the <a ext:cls="apf.form.DateField" ext:member="disabledDates" href="output/apf.form.DateField.html#disabledDates">disabledDates</a> config
for details on supported values) used to disable a pattern of dates.
Replaces any existing disabled days (by index, 0-6) with new values and refreshes the DatePicker.
An array of disabled day indexes. See the <a ext:cls="apf.form.DateField" ext:member="disabledDays" href="output/apf.form.DateField.html#disabledDays">disabledDays</a> config
for details on supported values.
Replaces any existing <a ext:cls="apf.form.DateField" ext:member="minValue" href="output/apf.form.DateField.html#minValue">minValue</a> with the new value and refreshes the DatePicker.
The minimum date that can be selected
Replaces any existing <a ext:cls="apf.form.DateField" ext:member="maxValue" href="output/apf.form.DateField.html#maxValue">maxValue</a> with the new value and refreshes the DatePicker.
The maximum date that can be selected
Returns the current date value of the date field.
Sets the value of the date field. You can pass a date object or any string that can be parsed into a valid
date, using DateField.format as the date format, according to the same rules as <a ext:cls="Date" ext:member="parseDate" href="output/Date.html#parseDate">Date.parseDate</a>
(the default format used is "m/d/Y").
<br />Usage:
<pre><code>//All of these calls set the same date value (May 4, 2006)
//Pass a date object:
var dt = new Date('5/4/2006');
dateField.setValue(dt);
//Pass a date string (default format):
dateField.setValue('05/04/2006');
//Pass a date string (custom format):
dateField.format = 'Y-m-d';
dateField.setValue('2006-05-04');</code></pre>
The date or valid date string
@hide
@hide
Base class for form fields that provides default event handling, sizing, value handling and other functionality.
Creates a new Field
Configuration options
Returns the name attribute of the field if available
Returns true if this field has been changed since it was originally loaded and is not disabled.
Resets the current field value to the originally loaded value and clears any validation messages
Returns whether or not the field value is currently valid
True to disable marking the field invalid
Validates the field value
Mark this field as invalid, using <a ext:cls="apf.form.Field" ext:member="msgTarget" href="output/apf.form.Field.html#msgTarget">msgTarget</a> to determine how to display the error and
applying <a ext:cls="apf.form.Field" ext:member="invalidClass" href="output/apf.form.Field.html#invalidClass">invalidClass</a> to the field's element.
(optional) The validation message (defaults to <a ext:cls="apf.form.Field" ext:member="invalidText" href="output/apf.form.Field.html#invalidText">invalidText</a>)
Clear any invalid styles/messages for this field
Returns the raw data value which may or may not be a valid, defined value. To return a normalized value see <a ext:cls="apf.form.Field" ext:member="getValue" href="output/apf.form.Field.html#getValue">getValue</a>.
Returns the normalized data value (undefined or emptyText will be returned as ''). To return the raw value see <a ext:cls="apf.form.Field" ext:member="getRawValue" href="output/apf.form.Field.html#getRawValue">getRawValue</a>.
Sets the underlying DOM field's value directly, bypassing validation. To set the value with validation see <a ext:cls="apf.form.Field" ext:member="setValue" href="output/apf.form.Field.html#setValue">setValue</a>.
The value to set
Sets a data value into the field and validates it. To set the value directly without validation see <a ext:cls="apf.form.Field" ext:member="setRawValue" href="output/apf.form.Field.html#setRawValue">setRawValue</a>.
The value to set
Standard container used for grouping form fields.
Configuration options
@hide
@hide
@hide
@hide
@hide
@hide
Standard form container.
<p><b>Although they are not listed, this class also accepts all the config options required to configure its internal <a ext:cls="apf.form.BasicForm" href="output/apf.form.BasicForm.html">apf.form.BasicForm</a></b></p>
<p>The BasicForm is configured using the <a ext:cls="apf.form.FormPanel" ext:member="initialConfig" href="output/apf.form.FormPanel.html#initialConfig">initialConfig</a> of the FormPanel - that is the configuration object passed to the constructor.
This means that if you subclass FormPanel, and you wish to configure the BasicForm, you will need to insert any configuration options
for the BasicForm into the <tt><b>initialConfig</b></tt> property. Applying BasicForm configuration settings to <b><tt>this</tt></b> will
not affect the BasicForm's configuration.</p>
<br><br>
FormPanel uses a <a ext:cls="apf.layout.FormLayout" href="output/apf.layout.FormLayout.html">apf.layout.FormLayout</a> internally, and that is required for fields and labels to work correctly
within the FormPanel's layout. To nest additional layout styles within a FormPanel, you should nest additional Panels
or other containers that can provide additional layout functionality. <b>You should not override FormPanel's layout.</b>
<br><br>
By default, apf Forms are submitted through Ajax, using <a ext:cls="apf.form.Action" href="output/apf.form.Action.html">apf.form.Action</a>.
To enable normal browser submission of the apf Form contained in this FormPanel,
override the Form's onSubmit, and submit methods:<br><br><pre><code>var myForm = new apf.form.FormPanel({
onSubmit: apf.emptyFn,
submit: function() {
this.getForm().getEl().dom.submit();
}
});</code></pre><br>
Configuration options
Provides access to the <a ext:cls="apf.form.BasicForm" href="output/apf.form.BasicForm.html">Form</a> which this Panel contains.
Starts monitoring of the valid state of this form. Usually this is done by passing the config
option "monitorValid"
Stops monitoring of the valid state of this form
This is a proxy for the underlying BasicForm's <a ext:cls="apf.form.BasicForm" ext:member="load" href="output/apf.form.BasicForm.html#load">apf.form.BasicForm.load</a> call.
The options to pass to the action (see <a ext:cls="apf.form.BasicForm" ext:member="doAction" href="output/apf.form.BasicForm.html#doAction">apf.form.BasicForm.doAction</a> for details)
A basic hidden field for storing hidden values in forms that need to be passed in the form submit.
Create a new Hidden field.
Configuration options
Provides a lightweight HTML Editor component. Some toolbar features are not supported by Safari and will be
automatically hidden when needed. These are noted in the config options where appropriate.
<br><br>The editor's toolbar buttons have tooltips defined in the <a ext:cls="apf.form.HtmlEditor" ext:member="buttonTips" href="output/apf.form.HtmlEditor.html#buttonTips">buttonTips</a> property, but they are not
enabled by default unless the global <a ext:cls="apf.QuickTips" href="output/apf.QuickTips.html">apf.QuickTips</a> singleton is <a ext:cls="apf.QuickTips" ext:member="init" href="output/apf.QuickTips.html#init">initialized</a>.
<br><br><b>Note: The focus/blur and validation marking functionality inherited from apf.form.Field is NOT
supported by this editor.</b>
<br><br>An Editor is a sensitive component that can't be used in all spots standard fields can be used. Putting an Editor within
any element that has display set to 'none' can cause problems in Safari and Firefox due to their default iframe reloading bugs.
<br><br>Example usage:
<pre><code>// Simple example rendered with default options:
apf.QuickTips.init(); // enable tooltips
new apf.form.HtmlEditor({
renderTo: apf.getBody(),
width: 800,
height: 300
});
// Passed via xtype into a container and with custom options:
apf.QuickTips.init(); // enable tooltips
new apf.Panel({
title: 'HTML Editor',
renderTo: apf.getBody(),
width: 600,
height: 300,
frame: true,
layout: 'fit',
items: {
xtype: 'htmleditor',
enableColors: false,
enableAlignments: false
}
});</code></pre>
Create a new HtmlEditor
Object collection of toolbar tooltips for the buttons in the editor. The key
is the command id associated with that button and the value is a valid QuickTips object.
For example:
<pre><code>{
bold : {
title: 'Bold (Ctrl+B)',
text: 'Make the selected text bold.',
cls: 'x-html-editor-tip'
},
italic : {
title: 'Italic (Ctrl+I)',
text: 'Make the selected text italic.',
cls: 'x-html-editor-tip'
},
...</code></pre>
@hide
Protected method that will not generally be called directly. It
is called when the editor initializes the iframe with HTML contents. Override this method if you
want to change the initialization markup of the iframe (e.g. to add stylesheets).
Toggles the editor between standard and source edit mode.
(optional) True for source edit, false for standard
Overridden and disabled. The editor element does not support standard valid/invalid marking. @hide
Overridden and disabled. The editor element does not support standard valid/invalid marking. @hide
Protected method that will not generally be called directly. If you need/want
custom HTML cleanup, this is the method you should override.
The HTML to be cleaned
return {String} The cleaned HTML
Protected method that will not generally be called directly. Syncs the contents
of the editor iframe with the textarea.
Protected method that will not generally be called directly. Pushes the value of the textarea
into the iframe editor.
Protected method that will not generally be called directly. It triggers
a toolbar update by reading the markup state of the current selection in the editor.
Executes a Midas editor command on the editor document and performs necessary focus and
toolbar updates. <b>This should only be called after the editor is initialized.</b>
The Midas command
(optional) The value to pass to the command (defaults to null)
Executes a Midas editor command directly on the editor document.
For visual commands, you should use <a ext:cls="apf.form.HtmlEditor" ext:member="relayCmd" href="output/apf.form.HtmlEditor.html#relayCmd">relayCmd</a> instead.
<b>This should only be called after the editor is initialized.</b>
The Midas command
(optional) The value to pass to the command (defaults to null)
Inserts the passed text at the current cursor position. Note: the editor must be initialized and activated
to insert text.
Returns the editor's toolbar. <b>This is only available after the editor has been rendered.</b>
@hide
@hide
@hide
@hide
@hide
Basic Label field.
Creates a new Label
The configuration options. If an element is passed, it is set as the internal
element and its id used as the component id. If a string is passed, it is assumed to be the id of an existing element
and is used as the component id. Otherwise, it is assumed to be a standard config object and is applied to the component.
Updates the label's innerHTML with the specified string.
The new label text
(optional) False to skip HTML-encoding the text when rendering it
to the label (defaults to true which encodes the value). This might be useful if you want to include
tags in the label's innerHTML rather than rendering them as string literals per the default logic.
Numeric text field that provides automatic keystroke filtering and numeric validation.
Creates a new NumberField
Configuration options
Single radio field. Same as Checkbox, but provided as a convenience for automatically setting the input type.
Radio grouping is handled automatically by the browser if you give each radio in a group the same name.
Creates a new Radio
Configuration options
If this radio is part of a group, it will return the selected value
Sets either the checked/unchecked status of this Radio, or, if a string value
is passed, checks a sibling Radio of the same name whose value is the value specified.
Checked value, or the value of the sibling radio button to check.
Overridden and disabled. The editor element does not support standard valid/invalid marking. @hide
Overridden and disabled. The editor element does not support standard valid/invalid marking. @hide
A grouping container for <a ext:cls="apf.form.Radio" href="output/apf.form.Radio.html">apf.form.Radio</a> controls.
Creates a new CheckboxGroup
Configuration options
Multiline text field. Can be used as a direct replacement for traditional textarea fields, plus adds
support for auto-sizing.
Creates a new TextArea
Configuration options
Automatically grows the field to accomodate the height of the text up to the maximum field height allowed.
This only takes effect if grow = true, and fires the <a ext:cls="apf.form.TextArea" ext:member="autosize" href="output/apf.form.TextArea.html#autosize">autosize</a> event if the height changes.
Basic text field. Can be used as a direct replacement for traditional text inputs, or as the base
class for more sophisticated input controls (like <a ext:cls="apf.form.TextArea" href="output/apf.form.TextArea.html">apf.form.TextArea</a> and <a ext:cls="apf.form.ComboBox" href="output/apf.form.ComboBox.html">apf.form.ComboBox</a>).
Creates a new TextField
Configuration options
Resets the current field value to the originally-loaded value and clears any validation messages.
Also adds emptyText and emptyClass if the original value was blank.
Validates a value according to the field's validation rules and marks the field as invalid
if the validation fails
The value to validate
Selects text in this field
(optional) The index where the selection should start (defaults to 0)
(optional) The index where the selection should end (defaults to the text length)
Automatically grows the field to accomodate the width of the text up to the maximum field width allowed.
This only takes effect if grow = true, and fires the <a ext:cls="apf.form.TextField" ext:member="autosize" href="output/apf.form.TextField.html#autosize">autosize</a> event.
Provides a time input field with a time dropdown and automatic time validation. Example usage:
<pre><code>new apf.form.TimeField({
minValue: '9:00 AM',
maxValue: '6:00 PM',
increment: 30
});</code></pre>
Create a new TimeField
@hide
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 <a ext:cls="apf.form.TriggerField" ext:member="onTriggerClick" href="output/apf.form.TriggerField.html#onTriggerClick">onTriggerClick</a>. You can create a TriggerField directly, as it renders exactly like a combobox
for which you can provide a custom implementation. For example:
<pre><code>var trigger = new apf.form.TriggerField();
trigger.onTriggerClick = myTriggerFn;
trigger.applyToMarkup('my-field');</code></pre>
However, in general you will most likely want to use TriggerField as the base class for a reusable component.
<a ext:cls="apf.form.DateField" href="output/apf.form.DateField.html">apf.form.DateField</a> and <a ext:cls="apf.form.ComboBox" href="output/apf.form.ComboBox.html">apf.form.ComboBox</a> are perfect examples of this.
Create a new TriggerField.
Configuration options (valid {@apf.form.TextField} config options will also be applied
to the base TextField)
@hide
The function that should handle the trigger's click event. This method does nothing by default until overridden
by an implementing function.
Overridable validation definitions. The validations provided are basic and intended to be easily customizable and extended.<br><br><i>This class is a singleton and cannot be created directly.</i>
The error text to display when the email validation function returns false
The keystroke filter mask to be applied on email input. See the <a ext:cls="apf.form.VTypes" ext:member="email" href="output/apf.form.VTypes.html#email">email</a> method for
information about more complex email validation.
The error text to display when the url validation function returns false
The error text to display when the alpha validation function returns false
The keystroke filter mask to be applied on alpha input
The error text to display when the alphanumeric validation function returns false
The keystroke filter mask to be applied on alphanumeric input
The function used to validate email addresses. Note that this is a very basic validation -- complete
validation per the email RFC specifications is very complex and beyond the scope of this class, although
this function can be overridden if a more comprehensive validation scheme is desired. See the validation
section of the <a href="http://en.wikipedia.org/wiki/E-mail_address">Wikipedia article on email addresses</a>
for additional information.
The email address
The function used to validate URLs
The URL
The function used to validate alpha values
The value
The function used to validate alphanumeric values
The value
Abstract base class for grid SelectionModels. It provides the interface that should be
implemented by descendant classes. This class should not be directly instantiated.
Locks the selections.
Unlocks the selections.
Returns true if the selections are locked.
This class provides the basic implementation for single cell selection in a grid. The object stored
as the selection and returned by <a ext:cls="getSelectedCell" href="output/getSelectedCell.html">getSelectedCell</a> contains the following properties:
<div class="mdetail-params"><ul>
<li><b>record</b> : apf.data.record<p class="sub-desc">The <a ext:cls="apf.data.Record" href="output/apf.data.Record.html">Record</a>
which provides the data for the row containing the selection</p></li>
<li><b>cell</b> : apf.data.record<p class="sub-desc">An object containing the
following properties:
<div class="mdetail-params"><ul>
<li><b>rowIndex</b> : Number<p class="sub-desc">The index of the selected row</p></li>
<li><b>cellIndex</b> : Number<p class="sub-desc">The index of the selected cell<br>
<b>Note that due to possible column reordering, the cellIndex should not be used as an index into
the Record's data. Instead, the <i>name</i> of the selected field should be determined
in order to retrieve the data value from the record by name:</b><pre><code>var fieldName = grid.getColumnModel().getDataIndex(cellIndex);
var data = record.get(fieldName);</code></pre></p></li>
</ul></div></p></li>
</ul></div>
The object containing the configuration of this model.
Returns the currently selected cell's row and column indexes as an array (e.g., [0, 0]).
Clears all selections.
to prevent the gridview from being notified about the change.
Returns true if there is a selection.
Selects a cell.
A custom selection model that renders a column of checkboxes that can be toggled to select or deselect rows.
The configuration options
This is the default implementation of a ColumnModel used by the Grid. This class is initialized
with an Array of column config objects.
<br><br>
An individual column's config object defines the header string, the <a ext:cls="apf.data.Record" href="output/apf.data.Record.html">apf.data.Record</a>
field the column draws its data from, an optional rendering function to provide customized
data formatting, and the ability to apply a CSS class to all cells in a column through its
<a ext:cls="apf.grid.ColumnModel" ext:member="id" href="output/apf.grid.ColumnModel.html#id">id</a> config option.<br>
<br>Usage:<br>
<pre><code>var colModel = new apf.grid.ColumnModel([
{header: "Ticker", width: 60, sortable: true},
{header: "Company Name", width: 150, sortable: true},
{header: "Market Cap.", width: 100, sortable: true},
{header: "$ Sales", width: 100, sortable: true, renderer: money},
{header: "Employees", width: 100, sortable: true, resizable: false}
]);</code></pre>
<p>
The config options <b>defined by</b< this class are options which may appear in each
individual column definition.
An Array of column config objects. See this class's
config objects for details.
The width of columns which have no width specified (defaults to 100)
Default sortable of columns which have no sortable specified (defaults to false)
Returns the id of the column at the specified index.
The column index
Reconfigures this column model
Array of Column configs
Returns the column for a specified id.
The column id
Returns the index for a specified column id.
The column id
Moves a column from one position to another.
The index of the column to move.
The position at which to reinsert the coolumn.
Returns the number of columns.
Returns the column configs that return true by the passed function that is called with (columnConfig, index)
(optional)
Returns true if the specified column is sortable.
The column index
Returns true if the specified column menu is disabled.
The column index
Returns the rendering (formatting) function defined for the column.
The column index.
Sets the rendering (formatting) function for a column. See <a ext:cls="apf.util.Format" href="output/apf.util.Format.html">apf.util.Format</a> for some
default formatting functions.
The column index
The function to use to process the cell's raw data
to return HTML markup for the grid view. The render function is called with
the following parameters:<ul>
<li><b>value</b> : Object<p class="sub-desc">The data value for the cell.</p></li>
<li><b>metadata</b> : Object<p class="sub-desc">An object in which you may set the following attributes:<ul>
<li><b>css</b> : String<p class="sub-desc">A CSS class name to add to the cell's TD element.</p></li>
<li><b>attr</b> : String<p class="sub-desc">An HTML attribute definition string to apply to the data container element <i>within</i> the table cell
(e.g. 'style="color:red;"').</p></li></ul></p></li>
<li><b>record</b> : apf.data.record<p class="sub-desc">The <a ext:cls="apf.data.Record" href="output/apf.data.Record.html">apf.data.Record</a> from which the data was extracted.</p></li>
<li><b>rowIndex</b> : Number<p class="sub-desc">Row index</p></li>
<li><b>colIndex</b> : Number<p class="sub-desc">Column index</p></li>
<li><b>store</b> : apf.data.Store<p class="sub-desc">The <a ext:cls="apf.data.Store" href="output/apf.data.Store.html">apf.data.Store</a> object from which the Record was extracted.</p></li></ul>
Returns the width for the specified column.
The column index
Sets the width for a column.
The column index
The new width
Returns the total width of all columns.
True to include hidden column widths
Returns the header for the specified column.
The column index
Sets the header for a column.
The column index
The new header
Returns the tooltip for the specified column.
The column index
Sets the tooltip for a column.
The column index
The new tooltip
Returns the dataIndex for the specified column.
The column index
Sets the dataIndex for a column.
The column index
The new dataIndex
Finds the index of the first matching column for the given dataIndex.
The dataIndex to find
Returns true if the cell is editable.
The column index
The row index
Returns the editor defined for the cell/column.
The column index
The row index
Sets if a column is editable.
The column index
True if the column is editable
Returns true if the column is hidden.
The column index
Returns true if the column width cannot be changed
Returns true if the column can be resized
Sets if a column is hidden.
The column index
True if the column is hidden
Sets the editor for a column.
The column index
The editor object
Class for creating and editable grid.
The config object
Starts editing the specified for the specified row/column
Stops any active editing
(optional) True to cancel any changes
<p>A customized implementation of a <a ext:cls="apf.dd.DragZone" href="output/apf.dd.DragZone.html">DragZone</a> which provides default implementations of two of the
template methods of DragZone to enable dragging of the selected rows of a GridPanel.</p>
<p>A cooperating <a ext:cls="apf.dd.DropZone" href="output/apf.dd.DropZone.html">DropZone</a> must be created who's template method implementations of
<a ext:cls="apf.dd.DropZone" ext:member="onNodeEnter" href="output/apf.dd.DropZone.html#onNodeEnter">onNodeEnter</a>, <a ext:cls="apf.dd.DropZone" ext:member="onNodeOver" href="output/apf.dd.DropZone.html#onNodeOver">onNodeOver</a>,
<a ext:cls="apf.dd.DropZone" ext:member="onNodeOut" href="output/apf.dd.DropZone.html#onNodeOut">onNodeOut</a> and <a ext:cls="apf.dd.DropZone" ext:member="onNodeDrop" href="output/apf.dd.DropZone.html#onNodeDrop">onNodeDrop</a></p> are able
to process the <a ext:cls="apf.grid.GridDragZone" ext:member="getDragData" href="output/apf.grid.GridDragZone.html#getDragData">data</a> which is provided.
<p>The provided implementation of the getDragData method which collects the data to be dragged from the GridPanel on mousedown.</p>
<p>This data is available for processing in the <a ext:cls="apf.dd.DropZone" ext:member="onNodeEnter" href="output/apf.dd.DropZone.html#onNodeEnter">onNodeEnter</a>, <a ext:cls="apf.dd.DropZone" ext:member="onNodeOver" href="output/apf.dd.DropZone.html#onNodeOver">onNodeOver</a>,
<a ext:cls="apf.dd.DropZone" ext:member="onNodeOut" href="output/apf.dd.DropZone.html#onNodeOut">onNodeOut</a> and <a ext:cls="apf.dd.DropZone" ext:member="onNodeDrop" href="output/apf.dd.DropZone.html#onNodeDrop">onNodeDrop</a> methods of a cooperating <a ext:cls="apf.dd.DropZone" href="output/apf.dd.DropZone.html">DropZone</a>.</p>
<p>The data object contains the following properties:<ul>
<li><b>grid</b> : apf.Grid.GridPanel<div class="sub-desc">The GridPanel from which the data is being dragged.</div></li>
<li><b>ddel</b> : htmlElement<div class="sub-desc">An htmlElement which provides the "picture" of the data being dragged.</div></li>
<li><b>rowIndex</b> : Number<div class="sub-desc">The index of the row which receieved the mousedown gesture which triggered the drag.</div></li>
<li><b>selections</b> : Array<div class="sub-desc">An Array of the selected Records which are being dragged from the GridPanel.</div></li>
</ul></p>
<p>The provided implementation of the onInitDrag method. Sets the <tt>innerHTML</tt> of the drag proxy which provides the "picture"
of the data being dragged.</p>
<p>The <tt>innerHTML</tt> data is found by calling the owning GridPanel's <a ext:cls="apf.grid.GridPanel" ext:member="getDragDropText" href="output/apf.grid.GridPanel.html#getDragDropText">getDragDropText</a>.</p>
An empty immplementation. Implement this to provide behaviour after a repair of an invalid drop. An implementation might highlight
the selected rows to show that they have not been dragged.
<p>An empty implementation. Implement this to provide coordinates for the drag proxy to slide back to after an invalid drop.</p>
<p>Called before a repair of an invalid drop to get the XY to animate to.</p>
The mouse up event
This class represents the primary interface of a component based grid control.
<br><br>Usage:
<pre><code>var grid = new apf.grid.GridPanel({
store: new apf.data.Store({
reader: reader,
data: xg.dummyData
}),
columns: [
{id:'company', header: "Company", width: 200, sortable: true, dataIndex: 'company'},
{header: "Price", width: 120, sortable: true, renderer: apf.util.Format.usMoney, dataIndex: 'price'},
{header: "Change", width: 120, sortable: true, dataIndex: 'change'},
{header: "% Change", width: 120, sortable: true, dataIndex: 'pctChange'},
{header: "Last Updated", width: 135, sortable: true, renderer: apf.util.Format.dateRenderer('m/d/Y'), dataIndex: 'lastChange'}
],
viewConfig: {
forceFit: true
},
sm: new apf.grid.RowSelectionModel({singleSelect:true}),
width:600,
height:300,
frame:true,
title:'Framed with Checkbox Selection and Horizontal Scrolling',
iconCls:'icon-grid'
});</code></pre>
<b>Notes:</b><ul>
<li>Although this class inherits many configuration options from base classes, some of them
(such as autoScroll, layout, items, etc) are not used by this class, and will have no effect.</li>
<li>A grid <b>requires</b> a width in which to scroll its columns, and a height in which to scroll its rows. The dimensions can either
be set through the <a ext:cls="apf.grid.GridPanel" ext:member="height" href="output/apf.grid.GridPanel.html#height">height</a> and <a ext:cls="apf.grid.GridPanel" ext:member="width" href="output/apf.grid.GridPanel.html#width">width</a> configuration options or automatically set by using the grid in a <a ext:cls="apf.Container" href="output/apf.Container.html">Container</a>
who's <a ext:cls="apf.Container" ext:member="layout" href="output/apf.Container.html#layout">layout</a> provides sizing of its child items.</li>
<li>To access the data in a Grid, it is necessary to use the data model encapsulated
by the <a ext:cls="apf.grid.GridPanel" ext:member="store" href="output/apf.grid.GridPanel.html#store">Store</a>. See the <a ext:cls="apf.grid.GridPanel" ext:member="cellclick" href="output/apf.grid.GridPanel.html#cellclick">cellclick</a> event.</li>
</ul>
The config object
Configures the text in the drag proxy (defaults to "{0} selected row(s)").
{0} is replaced with the number of selected rows.
@hide
@hide
Reconfigures the grid to use a different Store and Column Model.
The View will be bound to the new objects and refreshed.
The new <a ext:cls="apf.data.Store" href="output/apf.data.Store.html">apf.data.Store</a> object
The new <a ext:cls="apf.grid.ColumnModel" href="output/apf.grid.ColumnModel.html">apf.grid.ColumnModel</a> object
Returns the grid's underlying element.
Returns the grid's SelectionModel.
Returns the grid's data store.
Returns the grid's ColumnModel.
Returns the grid's GridView object.
Called to get grid's drag proxy text, by default returns this.ddText.
@hide
@hide
@hide
@hide
@hide
@hide
@hide
@hide
@hide
@hide
@hide
@hide
@hide
@hide
@hide
@hide
@hide
<p>This class encapsulates the user interface of an <a ext:cls="apf.grid.GridPanel" href="output/apf.grid.GridPanel.html">apf.grid.GridPanel</a>.
Methods of this class may be used to access user interface elements to enable
special display effects. Do not change the DOM structure of the user interface.</p>
<p>This class does not provide ways to manipulate the underlying data. The data
model of a Grid is held in an <a ext:cls="apf.data.Store" href="output/apf.data.Store.html">apf.data.Store</a>.</p>
The amount of space to reserve for the scrollbar (defaults to 19 pixels)
The CSS classes applied to a header when it is sorted. (defaults to ["sort-asc", "sort-desc"])
The text displayed in the "Sort Ascending" menu item
The text displayed in the "Sort Descending" menu item
The text displayed in the "Columns" menu item
Override this function to apply custom CSS classes to rows during rendering. You can also supply custom
parameters to the row template for the current row to customize how it is rendered using the <b>rowParams</b>
parameter. This function should return the CSS class name (or empty string '' for none) that will be added
to the row's wrapping div. To apply multiple class names, simply return them space-delimited within the string
(e.g., 'my-class another-class').
The <a ext:cls="apf.data.Record" href="output/apf.data.Record.html">apf.data.Record</a> corresponding to the current row
The row index
A config object that is passed to the row template during rendering that allows
customization of various aspects of a body row, if applicable. Note that this object will only be applied if
<a ext:cls="apf.grid.GridView" ext:member="enableRowBody" href="output/apf.grid.GridView.html#enableRowBody">enableRowBody</a> = true, otherwise it will be ignored. The object may contain any of these properties:<ul>
<li><code>body</code> : String <div class="sub-desc">An HTML fragment to be rendered as the cell's body content (defaults to '').</div></li>
<li><code>bodyStyle</code> : String <div class="sub-desc">A CSS style string that will be applied to the row's TR style attribute (defaults to '').</div></li>
<li><code>cols</code> : Number <div class="sub-desc">The column count to apply to the body row's TD colspan attribute (defaults to the current
column count of the grid).</div></li>
</ul>
The <a ext:cls="apf.data.Store" href="output/apf.data.Store.html">apf.data.Store</a> this grid is bound to
Return the <TR> HtmlElement which represents a Grid row for the specified index.
The row index
Returns the grid's <TD> HtmlElement at the specified coordinates.
The row index in which to find the cell.
The column index of the cell.
Return the <TD> HtmlElement which represents the Grid's header cell for the specified column index.
The column index
Scrolls the grid to the top
Focuses the specified row.
The row index
Focuses the specified cell.
The row index
The column index
Refreshs the grid UI
(optional) True to also refresh the headers
Adds the ability for single level grouping to the grid.
<pre><code>var grid = new apf.grid.GridPanel({
// A groupingStore is required for a GroupingView
store: new apf.data.GroupingStore({
reader: reader,
data: xg.dummyData,
sortInfo:{field: 'company', direction: "ASC"},
groupField:'industry'
}),
columns: [
{id:'company',header: "Company", width: 60, sortable: true, dataIndex: 'company'},
{header: "Price", width: 20, sortable: true, renderer: apf.util.Format.usMoney, dataIndex: 'price'},
{header: "Change", width: 20, sortable: true, dataIndex: 'change', renderer: apf.util.Format.usMoney},
{header: "Industry", width: 20, sortable: true, dataIndex: 'industry'},
{header: "Last Updated", width: 20, sortable: true, renderer: apf.util.Format.dateRenderer('m/d/Y'), dataIndex: 'lastChange'}
],
view: new apf.grid.GroupingView({
forceFit:true,
// custom grouping text template to display the number of items per group
groupTextTpl: '{text} ({[values.rs.length]} {[values.rs.length > 1 ? "Items" : "Item"]})'
}),
frame:true,
width: 700,
height: 450,
collapsible: true,
animCollapse: false,
title: 'Grouping Example',
iconCls: 'icon-grid',
renderTo: document.body
});</code></pre>
Toggles the specified group if no value is passed, otherwise sets the expanded state of the group to the value passed.
The groupId assigned to the group (see getGroupId)
(optional)
Toggles all groups if no value is passed, otherwise sets the expanded state of all groups to the value passed.
(optional)
Expands all grouped rows.
Collapses all grouped rows.
Dynamically tries to determine the groupId of a specific value
A custom column model for the <a ext:cls="apf.grid.PropertyGrid" href="output/apf.grid.PropertyGrid.html">apf.grid.PropertyGrid</a>. Generally it should not need to be used directly.
The grid this store will be bound to
The source data config object
A specialized grid implementation intended to mimic the traditional property grid as typically seen in
development IDEs. Each row in the grid represents a property of some object, and the data is stored
as a set of name/value pairs in <a ext:cls="apf.grid.PropertyRecord" href="output/apf.grid.PropertyRecord.html">apf.grid.PropertyRecord</a>s. Example usage:
<pre><code>
var grid = new apf.grid.PropertyGrid({
title: 'Properties Grid',
autoHeight: true,
width: 300,
renderTo: 'grid-ct',
source: {
"(name)": "My Object",
"Created": new Date(Date.parse('10/15/2006')),
"Available": false,
"Version": .01,
"Description": "A test object"
}
});</pre></code>
The grid config object
Sets the source data object containing the property data. The data object can contain one or more name/value
pairs representing all of the properties of an object to display in the grid, and this data will automatically
be loaded into the grid's <a ext:cls="apf.grid.PropertyGrid" ext:member="store" href="output/apf.grid.PropertyGrid.html#store">store</a>. The values should be supplied in the proper data type if needed,
otherwise string type will be assumed. If the grid already contains data, this method will replace any
existing data. See also the <a ext:cls="apf.grid.PropertyGrid" ext:member="source" href="output/apf.grid.PropertyGrid.html#source">source</a> config value. Example usage:
<pre><code>grid.setSource({
"(name)": "My Object",
"Created": new Date(Date.parse('10/15/2006')), // date type
"Available": false, // boolean type
"Version": .01, // decimal type
"Description": "A test object"
});</code></pre>
The data object
Gets the source data object containing the property data. See <a ext:cls="apf.grid.PropertyGrid" ext:member="setSource" href="output/apf.grid.PropertyGrid.html#setSource">setSource</a> for details regarding the
format of the data object.
A specific <a ext:cls="apf.data.Record" href="output/apf.data.Record.html">apf.data.Record</a> type that represents a name/value pair and is made to work with the
<a ext:cls="apf.grid.PropertyGrid" href="output/apf.grid.PropertyGrid.html">apf.grid.PropertyGrid</a>. Typically, PropertyRecords do not need to be created directly as they can be
created implicitly by simply using the appropriate data configs either via the <a ext:cls="apf.grid.PropertyGrid" ext:member="source" href="output/apf.grid.PropertyGrid.html#source">apf.grid.PropertyGrid.source</a>
config property or by calling <a ext:cls="apf.grid.PropertyGrid" ext:member="setSource" href="output/apf.grid.PropertyGrid.html#setSource">apf.grid.PropertyGrid.setSource</a>. However, if the need arises, these records
can also be created explicitly as shwon below. Example usage:
<pre><code>var rec = new apf.grid.PropertyRecord({
name: 'Birthday',
value: new Date(Date.parse('05/26/1972'))
});
// Add record to an already populated grid
grid.store.addSorted(rec);</code></pre>
A data object in the format: {name: [name], value: [value]}. The specified value's type
will be read automatically by the grid to determine the type of editor to use when displaying it.
A custom wrapper for the <a ext:cls="apf.grid.PropertyGrid" href="output/apf.grid.PropertyGrid.html">apf.grid.PropertyGrid</a>'s <a ext:cls="apf.data.Store" href="output/apf.data.Store.html">apf.data.Store</a>. This class handles the mapping
between the custom data source objects supported by the grid and the <a ext:cls="apf.grid.PropertyRecord" href="output/apf.grid.PropertyRecord.html">apf.grid.PropertyRecord</a> format
required for compatibility with the underlying store. Generally this class should not need to be used directly --
the grid's data should be accessed from the underlying store via the <a ext:cls="apf.grid.PropertyStore" ext:member="store" href="output/apf.grid.PropertyStore.html#store">store</a> property.
The grid this store will be bound to
The source data config object
This is a utility class that can be passed into a <a ext:cls="apf.grid.ColumnModel" href="output/apf.grid.ColumnModel.html">apf.grid.ColumnModel</a> as a column config that provides
an automatic row numbering column.
<br>Usage:<br>
<pre><code>// This is a typical column config with the first column providing row numbers
var colModel = new apf.grid.ColumnModel([
new apf.grid.RowNumberer(),
{header: "Name", width: 80, sortable: true},
{header: "Code", width: 50, sortable: true},
{header: "Description", width: 200, sortable: true}
]);</code></pre>
The configuration options
The default SelectionModel used by <a ext:cls="apf.grid.GridPanel" href="output/apf.grid.GridPanel.html">apf.grid.GridPanel</a>.
It supports multiple selections and keyboard selection/navigation. The objects stored
as selections and returned by <a ext:cls="apf.grid.RowSelectionModel" ext:member="getSelected" href="output/apf.grid.RowSelectionModel.html#getSelected">getSelected</a>, and <a ext:cls="apf.grid.RowSelectionModel" ext:member="getSelections" href="output/apf.grid.RowSelectionModel.html#getSelections">getSelections</a> are
the <a ext:cls="apf.data.Record" href="output/apf.data.Record.html">Record</a>s which provide the data for the selected rows.
Select records.
The records to select
(optional) True to keep existing selections
Gets the number of selected rows.
Selects the first row in the grid.
Select the last row.
(optional) True to keep existing selections
Selects the row immediately following the last selected row.
(optional) True to keep existing selections
Selects the row that precedes the last selected row.
(optional) True to keep existing selections
Returns true if there is a next record to select
Returns true if there is a previous record to select
Returns the selected records
Returns the first selected record.
Calls the passed function with each selection. If the function returns false, iteration is
stopped and this function returns false. Otherwise it returns true.
(optional)
Clears all selections.
Selects all rows.
Returns True if there is a selection.
Returns True if the specified row is selected.
The record or index of the record to check
Returns True if the specified record id is selected.
The id of record to check
Selects multiple rows.
Array of the indexes of the row to select
(optional) True to keep existing selections (defaults to false)
Selects a range of rows. All rows in between startRow and endRow are also selected.
The index of the first row in the range
The index of the last row in the range
(optional) True to retain existing selections
Deselects a range of rows. All rows in between startRow and endRow are also deselected.
The index of the first row in the range
The index of the last row in the range
Selects a row.
The index of the row to select
(optional) True to keep existing selections
Deselects a row.
The index of the row to deselect
<p>Inherits the anchoring of <a ext:cls="apf.layout.AnchorLayout" href="output/apf.layout.AnchorLayout.html">apf.layout.AnchorLayout</a> and adds the ability for x/y positioning using the
standard x and y component config options.</p>
@hide
<p>This is a layout that contains multiple panels in an expandable accordion style such that only one
panel can be open at any given time. Each panel has built-in support for expanding and collapsing.
This class is intended to be extended or created via the layout:'accordion' <a ext:cls="apf.Container" ext:member="layout" href="output/apf.Container.html#layout">apf.Container.layout</a>
config, and should generally not need to be created directly via the new keyword.</p>
<p>Note that when creating a layout via config, the layout-specific config properties must be passed in via
the <a ext:cls="apf.Container" ext:member="layoutConfig" href="output/apf.Container.html#layoutConfig">apf.Container.layoutConfig</a> object which will then be applied internally to the layout.
Example usage:</p>
<pre><code>var accordion = new apf.Panel({
title: 'Accordion Layout',
layout:'accordion',
defaults: {
// applied to each contained panel
bodyStyle: 'padding:15px'
},
layoutConfig: {
// layout-specific configs go here
titleCollapse: false,
animate: true,
activeOnTop: true
},
items: [{
title: 'Panel 1',
html: '<p>Panel content!</p>'
},{
title: 'Panel 2',
html: '<p>Panel content!</p>'
},{
title: 'Panel 3',
html: '<p>Panel content!</p>'
}]
});</code></pre>
<p>This is a layout that enables anchoring of contained elements relative to the container's dimensions. If
the container is resized, all anchored items are automatically rerendered according to their anchor rules.
This class is intended to be extended or created via the layout:'anchor' <a ext:cls="apf.Container" ext:member="layout" href="output/apf.Container.html#layout">apf.Container.layout</a> config,
and should generally not need to be created directly via the new keyword.</p>
<p>AnchorLayout does not have any direct config options (other than inherited ones). However, the container
using the AnchorLayout can supply an anchoring-specific config property of <b>anchorSize</b>. By default,
AnchorLayout will calculate anchor measurements based on the size of the container itself. However, if
anchorSize is specifed, the layout will use it as a virtual container for the purposes of calculating anchor
measurements based on it instead, allowing the container to be sized independently of the anchoring logic if necessary.</p>
<p>The items added to an AnchorLayout can also supply an anchoring-specific config property of <b>anchor</b> which
is a string containing two values: the horizontal anchor value and the vertical anchor value (for example, '100% 50%').
This value is what tells the layout how the item should be anchored to the container. The following types of
anchor values are supported:
<ul>
<li><b>Percentage</b>: Any value between 1 and 100, expressed as a percentage. The first anchor is the percentage
width that the item should take up within the container, and the second is the percentage height. Example: '100% 50%'
would render an item the complete width of the container and 1/2 its height. If only one anchor value is supplied
it is assumed to be the width value and the height will default to auto.</li>
<li><b>Offsets</b>: Any positive or negative integer value. The first anchor is the offset from the right edge of
the container, and the second is the offset from the bottom edge. Example: '-50 -100' would render an item the
complete width of the container minus 50 pixels and the complete height minus 100 pixels. If only one anchor value
is supplied it is assumed to be the right offset value and the bottom offset will default to 0.</li>
<li><b>Sides</b>: Valid values are 'right' (or 'r') and 'bottom' (or 'b'). Either the container must have a fixed
size or an anchorSize config value defined at render time in order for these to have any effect.</li>
</ul>
<p>Anchor values can also be mixed as needed. For example, '-50 75%' would render the width offset from the
container right edge by 50 pixels and 75% of the container's height.</p>
@hide
<p>This is a multi-pane, application-oriented UI layout style that supports multiple nested panels, automatic
split bars between regions and built-in expanding and collapsing of regions.
This class is intended to be extended or created via the layout:'border' <a ext:cls="apf.Container" ext:member="layout" href="output/apf.Container.html#layout">apf.Container.layout</a> config,
and should generally not need to be created directly via the new keyword.</p>
<p>BorderLayout does not have any direct config options (other than inherited ones). All configs available
for customizing the BorderLayout are at the <a ext:cls="apf.layout.BorderLayout.Region" href="output/apf.layout.BorderLayout.Region.html">apf.layout.BorderLayout.Region</a> and
<a ext:cls="apf.layout.BorderLayout.SplitRegion" href="output/apf.layout.BorderLayout.SplitRegion.html">apf.layout.BorderLayout.SplitRegion</a> levels.</p>
<p><b>The regions of a BorderLayout are fixed at render time and thereafter, no regions may be removed or
added.</b></p>
<p>Example usage:</p>
<pre><code>var border = new apf.Panel({
title: 'Border Layout',
layout:'border',
items: [{
title: 'South Panel',
region: 'south',
height: 100,
minSize: 75,
maxSize: 250,
margins: '0 5 5 5'
},{
title: 'West Panel',
region:'west',
margins: '5 0 0 5',
cmargins: '5 5 0 5',
width: 200,
minSize: 100,
maxSize: 300
},{
title: 'Main Content',
region:'center',
margins: '5 5 0 0'
}]
});</code></pre>
@hide
This is a region of a BorderLayout that acts as a subcontainer within the layout. Each region has its own
layout that is independent of other regions and the containing BorderLayout, and can be any of the valid
apf layout types. Region size is managed automatically and cannot be changed by the user -- for resizable
regions, see <a ext:cls="apf.layout.BorderLayout.SplitRegion" href="output/apf.layout.BorderLayout.SplitRegion.html">apf.layout.BorderLayout.SplitRegion</a>.
Create a new Region.
Any valid apf layout class
The configuration options
The region position. Valid values are: north, south, east, west and center. Every
BorderLayout must have a center region for the primary content -- all other regions are optional.
True if this region is collapsed. Read-only.
This region's layout position (north, south, east, west or center). Read-only.
True if this region is currently visible, else false.
Returns the current margins for this region. If the region is collapsed, the cmargins (collapsed
margins) value will be returned, otherwise the margins value will be returned.
Returns the current size of this region. If the region is collapsed, the size of the collapsedEl will
be returned, otherwise the size of the region's panel will be returned.
Sets the specified panel as the container element for this region.
The new panel
Returns the minimum allowable width for this region.
Returns the minimum allowable height for this region.
This is a specialized type of BorderLayout region that has a built-in <a ext:cls="apf.SplitBar" href="output/apf.SplitBar.html">apf.SplitBar</a> for user resizing of regions.
Create a new SplitRegion.
Any valid apf layout class
The configuration options
The region position. Valid values are: north, south, east, west and center. Every
BorderLayout must have a center region for the primary content -- all other regions are optional.
Returns a reference to the split bar in use by this region.
<p>This layout contains multiple panels, each fit to the container, where only a single panel can be
visible at any given time. This layout style is most commonly used for wizards, tab implementations, etc.
This class is intended to be extended or created via the layout:'card' <a ext:cls="apf.Container" ext:member="layout" href="output/apf.Container.html#layout">apf.Container.layout</a> config,
and should generally not need to be created directly via the new keyword.</p>
<p>The CardLayout's focal method is <a ext:cls="apf.layout.CardLayout" ext:member="setActiveItem" href="output/apf.layout.CardLayout.html#setActiveItem">setActiveItem</a>. Since only one panel is displayed at a time,
the only way to move from one panel to the next is by calling setActiveItem, passing the id or index of
the next panel to display. The layout itself does not provide a mechanism for handling this navigation,
so that functionality must be provided by the developer.</p>
<p>In the following example, a simplistic wizard setup is demonstrated. A button bar is added
to the footer of the containing panel to provide navigation buttons. The buttons will be handled by a
common navigation routine -- for this example, the implementation of that routine has been ommitted since
it can be any type of custom logic. Note that other uses of a CardLayout (like a tab control) would require a
completely different implementation. For serious implementations, a better approach would be to extend
CardLayout to provide the custom functionality needed. Example usage:</p>
<pre><code>var navHandler = function(direction){
// This routine could contain business logic required to manage the navigation steps.
// It would call setActiveItem as needed, manage navigation button state, handle any
// branching logic that might be required, handle alternate actions like cancellation
// or finalization, etc. A complete wizard implementation could get pretty
// sophisticated depending on the complexity required, and should probably be
// done as a subclass of CardLayout in a real-world implementation.
};
var card = new apf.Panel({
title: 'Example Wizard',
layout:'card',
activeItem: 0, // make sure the active item is set on the container config!
bodyStyle: 'padding:15px',
defaults: {
// applied to each contained panel
border:false
},
// just an example of one possible navigation scheme, using buttons
bbar: [
{
id: 'move-prev',
text: 'Back',
handler: navHandler.createDelegate(this, [-1]),
disabled: true
},
'->', // greedy spacer so that the buttons are aligned to each side
{
id: 'move-next',
text: 'Next',
handler: navHandler.createDelegate(this, [1])
}
],
// the panels (or "cards") within the layout
items: [{
id: 'card-0',
html: '<h1>Welcome to the Wizard!</h1><p>Step 1 of 3</p>'
},{
id: 'card-1',
html: '<p>Step 2 of 3</p>'
},{
id: 'card-2',
html: '<h1>Congratulations!</h1><p>Step 3 of 3 - Complete</p>'
}]
});</code></pre>
Sets the active (visible) item in the layout.
The string component id or numeric index of the item to activate
<p>This is the layout style of choice for creating structural layouts in a multi-column format where the width of
each column can be specified as a percentage or fixed width, but the height is allowed to vary based on the content.
This class is intended to be extended or created via the layout:'column' <a ext:cls="apf.Container" ext:member="layout" href="output/apf.Container.html#layout">apf.Container.layout</a> config,
and should generally not need to be created directly via the new keyword.</p>
<p>ColumnLayout does not have any direct config options (other than inherited ones), but it does support a
specific config property of <b><tt>columnWidth</tt></b> that can be included in the config of any panel added to it. The
layout will use the columnWidth (if present) or width of each panel during layout to determine how to size each panel.
If width or columnWidth is not specified for a given panel, its width will default to the panel's width (or auto).</p>
<p>The width property is always evaluated as pixels, and must be a number greater than or equal to 1.
The columnWidth property is always evaluated as a percentage, and must be a decimal value greater than 0 and
less than 1 (e.g., .25).</p>
<p>The basic rules for specifying column widths are pretty simple. The logic makes two passes through the
set of contained panels. During the first layout pass, all panels that either have a fixed width or none
specified (auto) are skipped, but their widths are subtracted from the overall container width. During the second
pass, all panels with columnWidths are assigned pixel widths in proportion to their percentages based on
the total <b>remaining</b> container width. In other words, percentage width panels are designed to fill the space
left over by all the fixed-width and/or auto-width panels. Because of this, while you can specify any number of columns
with different percentages, the columnWidths must always add up to 1 (or 100%) when added together, otherwise your
layout may not render as expected. Example usage:</p>
<pre><code>// All columns are percentages -- they must add up to 1
var p = new apf.Panel({
title: 'Column Layout - Percentage Only',
layout:'column',
items: [{
title: 'Column 1',
columnWidth: .25
},{
title: 'Column 2',
columnWidth: .6
},{
title: 'Column 3',
columnWidth: .15
}]
});
// Mix of width and columnWidth -- all columnWidth values must add up
// to 1. The first column will take up exactly 120px, and the last two
// columns will fill the remaining container width.
var p = new apf.Panel({
title: 'Column Layout - Mixed',
layout:'column',
items: [{
title: 'Column 1',
width: 120
},{
title: 'Column 2',
columnWidth: .8
},{
title: 'Column 3',
columnWidth: .2
}]
});</code></pre>
@hide
Every layout is composed of one or more <a ext:cls="apf.Container" href="output/apf.Container.html">apf.Container</a> elements internally, and ContainerLayout provides
the basic foundation for all other layout classes in apf. It is a non-visual class that simply provides the
base logic required for a Container to function as a layout. This class is intended to be extended and should
generally not need to be created directly via the new keyword.
A reference to the <a ext:cls="apf.Component" href="output/apf.Component.html">apf.Component</a> that is active. For example,
if(myPanel.layout.activeItem.id == 'item-1') { ... }. activeItem only applies to layout styles that can
display items one at a time (like <a ext:cls="apf.layout.Accordion" href="output/apf.layout.Accordion.html">apf.layout.Accordion</a>, <a ext:cls="apf.layout.CardLayout" href="output/apf.layout.CardLayout.html">apf.layout.CardLayout</a>
and <a ext:cls="apf.layout.FitLayout" href="output/apf.layout.FitLayout.html">apf.layout.FitLayout</a>). Read-only. Related to <a ext:cls="apf.Container" ext:member="activeItem" href="output/apf.Container.html#activeItem">apf.Container.activeItem</a>.
<p>This is a base class for layouts that contain a single item that automatically expands to fill the layout's
container. This class is intended to be extended or created via the layout:'fit' <a ext:cls="apf.Container" ext:member="layout" href="output/apf.Container.html#layout">apf.Container.layout</a>
config, and should generally not need to be created directly via the new keyword.</p>
<p>FitLayout does not have any direct config options (other than inherited ones). To fit a panel to a container
using FitLayout, simply set layout:'fit' on the container and add a single panel to it. If the container has
multiple panels, only the first one will be displayed. Example usage:</p>
<pre><code>var p = new apf.Panel({
title: 'Fit Layout',
layout:'fit',
items: {
title: 'Inner Panel',
html: '<p>This is the inner panel content</p>',
border: false
}
});</code></pre>
<p>This is a layout specifically designed for creating forms.
This class can be extended or created via the layout:'form' <a ext:cls="apf.Container" ext:member="layout" href="output/apf.Container.html#layout">apf.Container.layout</a> config,
and should generally not need to be created directly via the new keyword. However, when used in an application,
it will usually be preferrable to use a <a ext:cls="apf.form.FormPanel" href="output/apf.form.FormPanel.html">apf.form.FormPanel</a> (which automatically uses FormLayout as its layout
class) since it also provides built-in functionality for loading, validating and submitting the form.</p>
<p>Note that when creating a layout via config, the layout-specific config properties must be passed in via
the <a ext:cls="apf.Container" ext:member="layoutConfig" href="output/apf.Container.html#layoutConfig">apf.Container.layoutConfig</a> object which will then be applied internally to the layout. The container
using the FormLayout can also supply the following form-specific config properties which will be applied by the layout:
<ul>
<li><b>hideLabels</b>: (Boolean) True to hide field labels by default (defaults to false)</li>
<li><b>itemCls</b>: (String) A CSS class to add to the div wrapper that contains each field label
and field element (the default class is 'x-form-item' and itemCls will be added to that)</li>
<li><b>labelAlign</b>: (String) The default label alignment. The default value is empty string ''
for left alignment, but specifying 'top' will align the labels above the fields.</li>
<li><b>labelPad</b>: (Number) The default padding in pixels for field labels (defaults to 5). labelPad only
applies if labelWidth is also specified, otherwise it will be ignored.</li>
<li><b>labelWidth</b>: (Number) The default width in pixels of field labels (defaults to 100)</li>
</ul></p>
<p>Any type of components can be added to a FormLayout, but items that inherit from <a ext:cls="apf.form.Field" href="output/apf.form.Field.html">apf.form.Field</a>
can also supply the following field-specific config properties:
<ul>
<li><b>clearCls</b>: (String) The CSS class to apply to the special clearing div rendered directly after each
form field wrapper (defaults to 'x-form-clear-left')</li>
<li><b>fieldLabel</b>: (String) The text to display as the label for this field (defaults to '')</li>
<li><b>hideLabel</b>: (Boolean) True to hide the label and separator for this field (defaults to false).</li>
<li><b>itemCls</b>: (String) A CSS class to add to the div wrapper that contains this field label
and field element (the default class is 'x-form-item' and itemCls will be added to that). If supplied,
itemCls at the field level will override the default itemCls supplied at the container level.</li>
<li><b>labelSeparator</b>: (String) The separator to display after the text of the label for this field
(defaults to a colon ':' or the layout's value for <a ext:cls="apf.layout.FormLayout" ext:member="labelSeparator" href="output/apf.layout.FormLayout.html#labelSeparator">labelSeparator</a>). To hide the separator use empty string ''.</li>
<li><b>labelStyle</b>: (String) A CSS style specification string to add to the field label for this field
(defaults to '' or the layout's value for <a ext:cls="apf.layout.FormLayout" ext:member="labelStyle" href="output/apf.layout.FormLayout.html#labelStyle">labelStyle</a>).</li>
</ul>
Example usage:</p>
<pre><code>// Required if showing validation messages
apf.QuickTips.init();
// While you can create a basic Panel with layout:'form', practically
// you should usually use a FormPanel to also get its form functionality
// since it already creates a FormLayout internally.
var form = new apf.form.FormPanel({
labelWidth: 75,
title: 'Form Layout',
bodyStyle:'padding:15px',
width: 350,
labelPad: 10,
defaultType: 'textfield',
defaults: {
// applied to each contained item
width: 230,
msgTarget: 'side'
},
layoutConfig: {
// layout-specific configs go here
labelSeparator: ''
},
items: [{
fieldLabel: 'First Name',
name: 'first',
allowBlank: false
},{
fieldLabel: 'Last Name',
name: 'last'
},{
fieldLabel: 'Company',
name: 'company'
},{
fieldLabel: 'Email',
name: 'email',
vtype:'email'
}
],
buttons: [{
text: 'Save'
},{
text: 'Cancel'
}]
});</code></pre>
@hide
<p>This layout allows you to easily render content into an HTML table. The total number of columns can be
specified, and rowspan and colspan can be used to create complex layouts within the table.
This class is intended to be extended or created via the layout:'table' <a ext:cls="apf.Container" ext:member="layout" href="output/apf.Container.html#layout">apf.Container.layout</a> config,
and should generally not need to be created directly via the new keyword.</p>
<p>Note that when creating a layout via config, the layout-specific config properties must be passed in via
the <a ext:cls="apf.Container" ext:member="layoutConfig" href="output/apf.Container.html#layoutConfig">apf.Container.layoutConfig</a> object which will then be applied internally to the layout. In the
case of TableLayout, the only valid layout config property is <a ext:cls="apf.layout.TableLayout" ext:member="columns" href="output/apf.layout.TableLayout.html#columns">columns</a>. However, the items added to a
TableLayout can supply the following table-specific config properties:</p>
<ul>
<li><b>rowspan</b> Applied to the table cell containing the item.</li>
<li><b>colspan</b> Applied to the table cell containing the item.</li>
<li><b>cellId</b> An id applied to the table cell containing the item.</li>
<li><b>cellCls</b> A CSS class name added to the table cell containing the item.</li>
</ul>
<p>The basic concept of building up a TableLayout is conceptually very similar to building up a standard
HTML table. You simply add each panel (or "cell") that you want to include along with any span attributes
specified as the special config properties of rowspan and colspan which work exactly like their HTML counterparts.
Rather than explicitly creating and nesting rows and columns as you would in HTML, you simply specify the
total column count in the layoutConfig and start adding panels in their natural order from left to right,
top to bottom. The layout will automatically figure out, based on the column count, rowspans and colspans,
how to position each panel within the table. Just like with HTML tables, your rowspans and colspans must add
up correctly in your overall layout or you'll end up with missing and/or extra cells! Example usage:</p>
<pre><code>// This code will generate a layout table that is 3 columns by 2 rows
// with some spanning included. The basic layout will be:
// +--------+-----------------+
// | A | B |
// | |--------+--------|
// | | C | D |
// +--------+--------+--------+
var table = new apf.Panel({
title: 'Table Layout',
layout:'table',
defaults: {
// applied to each contained panel
bodyStyle:'padding:20px'
},
layoutConfig: {
// The total column count must be specified here
columns: 3
},
items: [{
html: '<p>Cell A content</p>',
rowspan: 2
},{
html: '<p>Cell B content</p>',
colspan: 2
},{
html: '<p>Cell C content</p>',
cellCls: 'highlight'
},{
html: '<p>Cell D content</p>'
}]
});</code></pre>
@hide
A base utility class that adapts a non-menu component so that it can be wrapped by a menu item and added to a menu.
It provides basic rendering, activation management and enable/disable logic required to work in menus.
Creates a new Adapter
The component being adapted to render into a menu
Configuration options
The base class for all items that render into menus. BaseItem provides default rendering, activated state
management and base configuration options shared by all menu components.
Creates a new BaseItem
Configuration options
The parent Menu of this Item.
Sets the function that will handle click events for this item (equivalent to passing in the <a ext:cls="apf.menu.BaseItem" ext:member="handler" href="output/apf.menu.BaseItem.html#handler">handler</a>
config property). If an existing handler is already registered, it will be unregistered for you.
The function that should be called on click
The scope that should be passed to the handler
Adds a menu item that contains a checkbox by default, but can also be part of a radio group.
Creates a new CheckItem
Configuration options
A function that handles the checkchange event. The function is undefined by default, but if an implementation
is provided, it will be called automatically when the checkchange event fires.
The checked value that was set
Set the checked state of this item
The new checked value
(optional) True to prevent the checkchange event from firing (defaults to false)
A menu item that wraps the <a ext:cls="apf.ColorPalette" href="output/apf.ColorPalette.html">apf.ColorPalette</a> component.
Creates a new ColorItem
Configuration options
The apf.ColorPalette object
A menu containing a <a ext:cls="apf.menu.ColorItem" href="output/apf.menu.ColorItem.html">apf.menu.ColorItem</a> component (which provides a basic color picker).
Creates a new ColorMenu
Configuration options
The <a ext:cls="apf.ColorPalette" href="output/apf.ColorPalette.html">apf.ColorPalette</a> instance for this ColorMenu
A menu item that wraps the <a ext:cls="apf.DatePicker" href="output/apf.DatePicker.html">apf.DatePicker</a> component.
Creates a new DateItem
Configuration options
The apf.DatePicker object
A menu containing a <a ext:cls="apf.menu.DateItem" href="output/apf.menu.DateItem.html">apf.menu.DateItem</a> component (which provides a date picker).
Creates a new DateMenu
Configuration options
The <a ext:cls="apf.DatePicker" href="output/apf.DatePicker.html">apf.DatePicker</a> instance for this DateMenu
A base class for all menu items that require menu-related functionality (like sub-menus) and are not static
display items. Item extends the base functionality of <a ext:cls="apf.menu.BaseItem" href="output/apf.menu.BaseItem.html">apf.menu.BaseItem</a> by adding menu-specific
activation and click handling.
Creates a new Item
Configuration options
Sets the text to display in this menu item
The text to display
Sets the CSS class to apply to the item's icon element
The CSS class to apply
A menu object. This is the container to which you add all other menu items. Menu can also serve as a base class
when you want a specialized menu based off of another component (like <a ext:cls="apf.menu.DateMenu" href="output/apf.menu.DateMenu.html">apf.menu.DateMenu</a> for example).
Creates a new Menu
Configuration options
A MixedCollection of this Menu's items
Read-only. Returns true if the menu is currently displayed, else false.
Displays this menu relative to another element
The element to align to
(optional) The <a ext:cls="apf.Element" ext:member="alignTo" href="output/apf.Element.html#alignTo">apf.Element.alignTo</a> anchor position to use in aligning to
the element (defaults to this.defaultAlign)
(optional) This menu's parent menu, if applicable (defaults to undefined)
Displays this menu at a specific xy position
Contains X & Y [x, y] values for the position at which to show the menu (coordinates are page-based)
(optional) This menu's parent menu, if applicable (defaults to undefined)
Hides this menu and optionally all parent menus
(optional) True to hide all parent menus recursively, if any (defaults to false)
Addds one or more items of any type supported by the Menu class, or that can be converted into menu items.
Any of the following are valid:
<ul>
<li>Any menu item object based on <a ext:cls="apf.menu.BaseItem" href="output/apf.menu.BaseItem.html">apf.menu.BaseItem</a></li>
<li>An HTMLElement object which will be converted to a menu item</li>
<li>A menu item config object that will be created as a new menu item</li>
<li>A string, which can either be '-' or 'separator' to add a menu separator, otherwise
it will be converted into a <a ext:cls="apf.menu.TextItem" href="output/apf.menu.TextItem.html">apf.menu.TextItem</a> and added</li>
</ul>
Usage:
<pre><code>// Create the menu
var menu = new apf.menu.Menu();
// Create a menu item to add by reference
var menuItem = new apf.menu.Item({ text: 'New Item!' });
// Add a bunch of items at once using different methods.
// Only the last item added will be returned.
var item = menu.add(
menuItem, // add existing item by ref
'Dynamic Item', // new TextItem
'-', // new separator
{ text: 'Config Item' } // new item by config
);</code></pre>
One or more menu items, menu item configs or other objects that can be converted to menu items
Returns this menu's underlying <a ext:cls="apf.Element" href="output/apf.Element.html">apf.Element</a> object
Adds a separator bar to the menu
Adds an <a ext:cls="apf.Element" href="output/apf.Element.html">apf.Element</a> object to the menu
The element or DOM node to add, or its id
Adds an existing object based on <a ext:cls="apf.menu.BaseItem" href="output/apf.menu.BaseItem.html">apf.menu.BaseItem</a> to the menu
The menu item to add
Creates a new <a ext:cls="apf.menu.Item" href="output/apf.menu.Item.html">apf.menu.Item</a> based an the supplied config object and adds it to the menu
A MenuItem config object
Creates a new <a ext:cls="apf.menu.TextItem" href="output/apf.menu.TextItem.html">apf.menu.TextItem</a> with the supplied text and adds it to the menu
The text to display in the menu item
Inserts an existing object based on <a ext:cls="apf.menu.BaseItem" href="output/apf.menu.BaseItem.html">apf.menu.BaseItem</a> to the menu at a specified index
The index in the menu's list of current items where the new item should be inserted
The menu item to add
Removes an <a ext:cls="apf.menu.Item" href="output/apf.menu.Item.html">apf.menu.Item</a> from the menu and destroys the object
The menu item to remove
Removes and destroys all items in the menu
Destroys the menu by unregistering it from <a ext:cls="apf.menu.MenuMgr" href="output/apf.menu.MenuMgr.html">apf.menu.MenuMgr</a>, purging event listeners,
removing all of the menus items, then destroying the underlying <a ext:cls="apf.Element" href="output/apf.Element.html">apf.Element</a>
Provides a common registry of all menu items on a page so that they can be easily accessed by id.<br><br><i>This class is a singleton and cannot be created directly.</i>
Hides all menus that are currently visible
Returns a <a ext:cls="apf.menu.Menu" href="output/apf.menu.Menu.html">apf.menu.Menu</a> object
The string menu id, an existing menu object reference, or a Menu config that will
be used to generate and return a new Menu instance.
Adds a separator bar to a menu, used to divide logical groups of menu items. Generally you will
add one of these by using "-" in you call to add() or in your items config rather than creating one directly.
Configuration options
Adds a static text string to a menu, usually used as either a heading or group separator.
Creates a new TextItem
If config is a string, it is used as the text to display, otherwise it
is applied as a config object (and should contain a <tt>text</tt> property).
The default Provider implementation which saves state via cookies.
<br />Usage:
<pre><code>var cp = new apf.state.CookieProvider({
path: "/cgi-bin/",
expires: new Date(new Date().getTime()+(1000*60*60*24*30)), //30 days
domain: "extjs.com"
});
apf.state.Manager.setProvider(cp);</code></pre>
Create a new CookieProvider
The configuration object
This is the global state manager. By default all components that are "state aware" check this class
for state information if you don't pass them a custom state provider. In order for this class
to be useful, it must be initialized with a provider when your application initializes. Example usage:
<pre><code>// in your initialization function
init : function(){
apf.state.Manager.setProvider(new apf.state.CookieProvider());
var win = new Window(...);
win.restoreState();
}</code></pre><br><br><i>This class is a singleton and cannot be created directly.</i>
Configures the default state provider for your application
The state provider to set
Returns the current value for a key
The key name
The default value to return if the key lookup does not match
Sets the value for a key
The key name
The state data
Clears a value from the state
The key name
Gets the currently configured state provider
Abstract base class for state provider implementations. This class provides methods
for encoding and decoding <b>typed</b> variables including dates and defines the
Provider interface.
Returns the current value for a key
The key name
A default value to return if the key's value is not found
Clears a value from the state
The key name
Sets the value for a key
The key name
The value to set
Decodes a string previously encoded with <a ext:cls="apf.state.Provider" ext:member="encodeValue" href="output/apf.state.Provider.html#encodeValue">encodeValue</a>.
The value to decode
Encodes a value including type information. Decode with <a ext:cls="apf.state.Provider" ext:member="decodeValue" href="output/apf.state.Provider.html#decodeValue">decodeValue</a>.
The value to encode
The attributes/config for the node or just a string with the text for the node
The loader used by this node (defaults to using the tree's defined loader)
Returns true if this node is currently loading
Returns true if this node has been loaded
Trigger a reload for this node
The default single selection for a TreePanel.
Select a node.
The node to select
Deselect a node.
The node to unselect
Clear all selections
Get the selected node
Returns true if the node is selected
The node to check
Selects the node above the selected node in the tree, intelligently walking the nodes
Selects the node above the selected node in the tree, intelligently walking the nodes
Multi selection for a TreePanel.
Select a node.
The node to select
(optional) An event associated with the selection
True to retain existing selections
Deselect a node.
The node to unselect
Clear all selections
Returns true if the node is selected
The node to check
Returns an array of the selected nodes
This class provides the default UI implementation for <b>root</b> apf TreeNodes.
The RootTreeNode UI implementation allows customizing the appearance of the root tree node.<br>
<p>
If you are customizing the Tree's user interface, you
may need to extend this class, but you should never need to instantiate this class.<br>
The <a ext:cls="apf.tree.TreePanel" href="output/apf.tree.TreePanel.html">apf.tree.TreePanel</a> for which to enable dragging
The TreePanel for this drag zone
The <a ext:cls="apf.tree.TreePanel" href="output/apf.tree.TreePanel.html">apf.tree.TreePanel</a> for which to enable dropping
The TreePanel for this drop zone
Arbitrary data that can be associated with this tree and will be included in the event object that gets
passed to any nodedragover event handler (defaults to {})
Provides editor functionality for inline tree node editing. Any valid <a ext:cls="apf.form.Field" href="output/apf.form.Field.html">apf.form.Field</a> subclass can be used
as the editor field.
(optional) Either a prebuilt <a ext:cls="apf.form.Field" href="output/apf.form.Field.html">apf.form.Field</a> instance or a Field config object
that will be applied to the default field instance (defaults to a <a ext:cls="apf.form.TextField" href="output/apf.form.TextField.html">apf.form.TextField</a>).
(optional) A TreeEditor config object
The tree node this editor is bound to. Read-only.
Note this class is experimental and doesn't update the indent (lines) or expand collapse icons of the nodes
Filter the data by a specific attribute.
Either string that the attribute value
should start with or a RegExp to test against the attribute
(optional) The attribute passed in your node's attributes collection. Defaults to "text".
(optional) The node to start the filter at.
Filter by a function. The passed function will be called with each
node in the tree (or from the startNode). If the function returns true, the node is kept
otherwise it is filtered. If a node is filtered, its children are also filtered.
The filter function
(optional) The scope of the function (defaults to the current node)
Clears the current filter. Note: with the "remove" option
set a filter cannot be cleared.
A TreeLoader provides for lazy loading of an <a ext:cls="apf.tree.TreeNode" href="output/apf.tree.TreeNode.html">apf.tree.TreeNode</a>'s child
nodes from a specified URL. The response must be a JavaScript Array definition
whose elements are node definition objects. eg:
<pre><code>[{
id: 1,
text: 'A leaf Node',
leaf: true
},{
id: 2,
text: 'A folder Node',
children: [{
id: 3,
text: 'A child Node',
leaf: true
}]
}]</code></pre>
<br><br>
A server request is sent, and child nodes are loaded only when a node is expanded.
The loading node's id is passed to the server under the parameter name "node" to
enable the server to produce the correct child nodes.
<br><br>
To pass extra parameters, an event handler may be attached to the "beforeload"
event, and the parameters specified in the TreeLoader's baseParams property:
<pre><code>myTreeLoader.on("beforeload", function(treeLoader, node) {
this.baseParams.category = node.attributes.category;
}, this);</code></pre>
This would pass an HTTP parameter called "category" to the server containing
the value of the Node's "category" attribute.
Creates a new Treeloader.
A config object containing config properties.
Load an <a ext:cls="apf.tree.TreeNode" href="output/apf.tree.TreeNode.html">apf.tree.TreeNode</a> from the URL specified in the constructor.
This is called automatically when a node is expanded, but may be used to reload
a node (or append new children if the <a ext:cls="apf.tree.TreeLoader" ext:member="clearOnLoad" href="output/apf.tree.TreeLoader.html#clearOnLoad">clearOnLoad</a> option is false.)
Override this function for custom TreeNode node implementation
The attributes/config for the node or just a string with the text for the node
Read-only. The text for this node. To change it use setText().
True if this node is disabled.
Read-only. The UI for this node
Returns true if this node is expanded
Returns the UI object for this node.
Sets the text for this node
Triggers selection of this node
Triggers deselection of this node
Returns true if this node is selected
Expand this node.
(optional) True to expand all children as well
(optional) false to cancel the default animation
(optional) A callback to be called when
expanding this node completes (does not wait for deep expand to complete).
Called with 1 parameter, this node.
Collapse this node.
(optional) True to collapse all children as well
(optional) false to cancel the default animation
Toggles expanded/collapsed state of the node
Ensures all parent nodes are expanded, and if necessary, scrolls
the node into view.
Expand all child nodes
(optional) true if the child nodes should also expand their child nodes
Collapse all child nodes
(optional) true if the child nodes should also collapse their child nodes
Disables this node
Enables this node
This class provides the default UI implementation for apf TreeNodes.
The TreeNode UI implementation is separate from the
tree implementation, and allows customizing of the appearance of
tree nodes.<br>
<p>
If you are customizing the Tree's user interface, you
may need to extend this class, but you should never need to instantiate this class.<br>
<p>
This class provides access to the user interface components of an apf TreeNode, through
<a ext:cls="apf.tree.TreeNode" ext:member="getUI" href="output/apf.tree.TreeNode.html#getUI">apf.tree.TreeNode.getUI</a>
Adds one or more CSS classes to the node's UI element.
Duplicate classes are automatically filtered out.
The CSS class to add, or an array of classes
Removes one or more CSS classes from the node's UI element.
The CSS class to remove, or an array of classes
Hides this node.
Shows this node.
Sets the checked status of the tree node to the passed value, or, if no value was passed,
toggles the checked status. If the node was rendered with no checkbox, this has no effect.
The new checked status.
Returns the <a> element that provides focus for the node's UI.
Returns the text node.
Returns the icon <img> element.
Returns the checked status of the node. If the node was rendered with no
checkbox, it returns false.
<p>The TreePanel provides tree-structured UI representation of tree-structured data.</p>
<p><a ext:cls="apf.tree.TreeNode" href="output/apf.tree.TreeNode.html">TreeNode</a>s added to the TreePanel may each contain metadata
used by your application in their <a ext:cls="apf.tree.TreeNode" ext:member="attributes" href="output/apf.tree.TreeNode.html#attributes">attributes</a> property.</p>
<p><b>A TreePanel must have a <a ext:cls="apf.tree.TreePanel" ext:member="root" href="output/apf.tree.TreePanel.html#root">root</a> node before it is rendered.</b> This may either be
specified using the <a ext:cls="apf.tree.TreePanel" ext:member="root" href="output/apf.tree.TreePanel.html#root">root</a> config option, or using the <a ext:cls="apf.tree.TreePanel" ext:member="setRootNode" href="output/apf.tree.TreePanel.html#setRootNode">setRootNode</a> method.
The root node of this tree.
The dropZone used by this tree if drop is enabled
The dragZone used by this tree if drag is enabled
@hide
@hide
Returns this root node for this tree
Sets the root node for this tree during initialization.
Gets a node in this tree by its id
Retrieve an array of checked nodes, or an array of a specific attribute of checked nodes (e.g. "id")
(optional) Defaults to null (return the actual nodes)
(optional) The node to start from, defaults to the root
Returns the container element for this TreePanel.
Returns the default <a ext:cls="apf.tree.TreeLoader" href="output/apf.tree.TreeLoader.html">apf.tree.TreeLoader</a> for this TreePanel.
Expand all nodes
Collapse all nodes
Returns the selection model used by this TreePanel.
Expands a specified path in this TreePanel. A path can be retrieved from a node with <a ext:cls="apf.data.Node" ext:member="getPath" href="output/apf.data.Node.html#getPath">apf.data.Node.getPath</a>
(optional) The attribute used in the path (see <a ext:cls="apf.data.Node" ext:member="getPath" href="output/apf.data.Node.html#getPath">apf.data.Node.getPath</a> for more info)
(optional) The callback to call when the expand is complete. The callback will be called with
(bSuccess, oLastNode) where bSuccess is if the expand was successful and oLastNode is the last node that was expanded.
Selects the node in this tree at the specified path. A path can be retrieved from a node with <a ext:cls="apf.data.Node" ext:member="getPath" href="output/apf.data.Node.html#getPath">apf.data.Node.getPath</a>
(optional) The attribute used in the path (see <a ext:cls="apf.data.Node" ext:member="getPath" href="output/apf.data.Node.html#getPath">apf.data.Node.getPath</a> for more info)
(optional) The callback to call when the selection is complete. The callback will be called with
(bSuccess, oSelNode) where bSuccess is if the selection was successful and oSelNode is the selected node.
Returns the underlying Element for this tree
@hide
@hide
@hide
@hide
@hide
@hide
@hide
@hide
@hide
@hide
@hide
@hide
@hide
@hide
@hide
@hide
@hide
Provides sorting of nodes in a <a ext:cls="apf.tree.TreePanel" href="output/apf.tree.TreePanel.html">apf.tree.TreePanel</a>. The TreeSorter automatically monitors events on the
associated TreePanel that might affect the tree's sort order (beforechildrenrendered, append, insert and textchange).
Example usage:<br />
<pre><code>new apf.tree.TreeSorter(myTree, {
folderSort: true,
dir: "desc",
sortType: function(node) {
// sort by a custom, typed attribute:
return parseInt(node.id, 10);
}
});</code></pre>
Utility class for manipulating CSS rules<br><br><i>This class is a singleton and cannot be created directly.</i>
Creates a stylesheet from a text blob of rules.
These rules will be wrapped in a STYLE tag and appended to the HEAD of the document.
The text containing the css rules
An id to add to the stylesheet for later removal
Removes a style or link tag by id
The id of the tag
Dynamically swaps an existing stylesheet reference for a new one
The id of an existing link tag to remove
The href of the new stylesheet to include
Refresh the rule cache if you have dynamically added stylesheets
Gets all css rules for the document
true to refresh the internal cache
Gets an an individual CSS rule by selector(s)
The CSS selector or an array of selectors to try. The first selector that is found is returned.
true to refresh the internal cache if you have recently updated any rules or added styles dynamically
Updates a rule property
If it's an array it tries each selector until it finds one. Stops immediately once one is found.
The css property
The new value for the property
A wrapper class which can be applied to any element. Fires a "click" event while the
mouse is pressed. The interval between firings may be specified in the config but
defaults to 20 milliseconds.
Optionally, a CSS class may be applied to the element during the time it is pressed.
The element to listen on
Provides a convenient method of performing setTimeout where a new
timeout cancels the old timeout. An example would be performing validation on a keypress.
You can use this class to buffer
the keypress events for a certain number of milliseconds, and perform only if they stop
for that amount of time.
The parameters to this constructor serve as defaults and are not required.
(optional) The default function to timeout
(optional) The default scope of that timeout
(optional) The default Array of arguments
Cancels any pending timeout and queues a new one
The milliseconds to delay
(optional) Overrides function passed to constructor
(optional) Overrides scope passed to constructor
(optional) Overrides args passed to constructor
Cancel the last queued timeout
Reusable data formatting functions<br><br><i>This class is a singleton and cannot be created directly.</i>
Truncate a string and add an ellipsis ('...') to the end if it exceeds the specified length
The string to truncate
The maximum length to allow before truncating
Checks a reference and converts it to empty string if it is undefined
Reference to check
Checks a reference and converts it to the default value if it's empty
Reference to check
The value to insert of it's undefined (defaults to "")
Convert certain characters (&, <, >, and ') to their HTML character equivalents for literal display in web pages.
The string to encode
Convert certain characters (&, <, >, and ') from their HTML character equivalents.
The string to decode
Trims any whitespace from either side of a string
The text to trim
Returns a substring from within an original string
The original text
The start index of the substring
The length of the substring
Converts a string to all lower case letters
The text to convert
Converts a string to all upper case letters
The text to convert
Converts the first character only of a string to upper case
The text to convert
Format a number as US currency
The numeric value to format
Parse a value into a formatted date using the specified format pattern.
The value to format (Strings must conform to the format expected by the javascript Date object's <a href="http://www.w3schools.com/jsref/jsref_parse.asp">parse()</a> method)
(optional) Any valid date format string (defaults to 'm/d/Y')
Returns a date rendering function that can be reused to apply a date format multiple times efficiently
Any valid date format string
Strips all HTML tags
The text from which to strip tags
Strips all script tags
The text from which to strip script tags
Simple format for a file size (xxx bytes, xxx KB, xxx MB)
The numeric value to format
Modified version of Douglas Crockford"s json.js that doesn"t
mess with the Object prototype
http://www.json.org/js.html<br><br><i>This class is a singleton and cannot be created directly.</i>
Encodes an Object, Array or other value
The variable to encode
Decodes (parses) a JSON string to an object. If the JSON is invalid, this function throws a SyntaxError.
The JSON string
A Collection class that maintains both numeric indexes and keys and exposes events.
True if the addAll function should add function references to the
collection (defaults to false)
A function that can accept an item of the type(s) stored in this MixedCollection
and return the key value for that item. This is used when available to look up the key on items that
were passed without an explicit key parameter to a MixedCollection method. Passing this parameter is
equivalent to providing an implementation for the <a ext:cls="apf.util.MixedCollection" ext:member="getKey" href="output/apf.util.MixedCollection.html#getKey">getKey</a> method.
Adds an item to the collection. Fires the <a ext:cls="apf.util.MixedCollection" ext:member="add" href="output/apf.util.MixedCollection.html#add">add</a> event when complete.
<p>The key to associate with the item, or the new item.</p>
<p>If you supplied a <a ext:cls="apf.util.MixedCollection" ext:member="getKey" href="output/apf.util.MixedCollection.html#getKey">getKey</a> implementation for this MixedCollection, or if the key
of your stored items is in a property called <tt><b>id</b></tt>, then the MixedCollection
will be able to <i>derive</i> the key for the new item. In this case just pass the new item in
this parameter.</p>
The item to add.
MixedCollection has a generic way to fetch keys if you implement getKey. The default implementation
simply returns <tt style="font-weight:bold;">item.id</tt> but you can provide your own implementation
to return a different value as in the following examples:
<pre><code>// normal way
var mc = new apf.util.MixedCollection();
mc.add(someEl.dom.id, someEl);
mc.add(otherEl.dom.id, otherEl);
//and so on
// using getKey
var mc = new apf.util.MixedCollection();
mc.getKey = function(el){
return el.dom.id;
};
mc.add(someEl);
mc.add(otherEl);
// or via the constructor
var mc = new apf.util.MixedCollection(false, function(el){
return el.dom.id;
});
mc.add(someEl);
mc.add(otherEl);</code></pre>
The item for which to find the key.
Replaces an item in the collection. Fires the <a ext:cls="apf.util.MixedCollection" ext:member="replace" href="output/apf.util.MixedCollection.html#replace">replace</a> event when complete.
<p>The key associated with the item to replace, or the replacement item.</p>
<p>If you supplied a <a ext:cls="apf.util.MixedCollection" ext:member="getKey" href="output/apf.util.MixedCollection.html#getKey">getKey</a> implementation for this MixedCollection, or if the key
of your stored items is in a property called <tt><b>id</b></tt>, then the MixedCollection
will be able to <i>derive</i> the key of the replacement item. If you want to replace an item
with one having the same key value, then just pass the replacement item in this parameter.</p>
o (optional) If the first parameter passed was a key, the item to associate
with that key.
Adds all elements of an Array or an Object to the collection.
An Object containing properties which will be added to the collection, or
an Array of values, each of which are added to the collection.
Executes the specified function once for every item in the collection, passing the following arguments:
<div class="mdetail-params"><ul>
<li><b>item</b> : Mixed<p class="sub-desc">The collection item</p></li>
<li><b>index</b> : Number<p class="sub-desc">The item's index</p></li>
<li><b>length</b> : Number<p class="sub-desc">The total number of items in the collection</p></li>
</ul></div>
The function should return a boolean value. Returning false from the function will stop the iteration.
The function to execute for each item.
(optional) The scope in which to execute the function.
Executes the specified function once for every key in the collection, passing each
key, and its associated item as the first two parameters.
The function to execute for each item.
(optional) The scope in which to execute the function.
Returns the first item in the collection which elicits a true return value from the
passed selection function.
The selection function to execute for each item.
(optional) The scope in which to execute the function.
Inserts an item at the specified index in the collection. Fires the <a ext:cls="apf.util.MixedCollection" ext:member="add" href="output/apf.util.MixedCollection.html#add">add</a> event when complete.
The index to insert the item at.
The key to associate with the new item, or the item itself.
(optional) If the second parameter was a key, the new item.
Remove an item from the collection.
The item to remove.
Remove an item from a specified index in the collection. Fires the <a ext:cls="apf.util.MixedCollection" ext:member="remove" href="output/apf.util.MixedCollection.html#remove">remove</a> event when complete.
The index within the collection of the item to remove.
Removed an item associated with the passed key fom the collection.
The key of the item to remove.
Returns the number of items in the collection.
Returns index within the collection of the passed Object.
The item to find the index of.
Returns index within the collection of the passed key.
The key to find the index of.
Returns the item associated with the passed key OR index. Key has priority over index. This is the equivalent
of calling <a ext:cls="apf.util.MixedCollection" ext:member="key" href="output/apf.util.MixedCollection.html#key">key</a> first, then if nothing matched calling <a ext:cls="apf.util.MixedCollection" ext:member="itemAt" href="output/apf.util.MixedCollection.html#itemAt">itemAt</a>.
The key or index of the item.
Returns the item at the specified index.
The index of the item.
Returns the item associated with the passed key.
The key of the item.
Returns true if the collection contains the passed Object as an item.
The Object to look for in the collection.
Returns true if the collection contains the passed Object as a key.
The key to look for in the collection.
Removes all items from the collection. Fires the <a ext:cls="apf.util.MixedCollection" ext:member="clear" href="output/apf.util.MixedCollection.html#clear">clear</a> event when complete.
Returns the first item in the collection.
Returns the last item in the collection.
Sorts this collection with the passed comparison function
(optional) "ASC" or "DESC"
(optional) comparison function
Sorts this collection by keys
(optional) "ASC" or "DESC"
(optional) a comparison function (defaults to case insensitive string)
Returns a range of items in this collection
(optional) defaults to 0
(optional) default to the last item
Filter the <i>objects</i> in this collection by a specific property.
Returns a new collection that has been filtered.
A property on your objects
Either string that the property values
should start with or a RegExp to test against the property
(optional) True to match any part of the string, not just the beginning
(optional) True for case sensitive comparison (defaults to False).
Filter by a function. Returns a <i>new</i> collection that has been filtered.
The passed function will be called with each object in the collection.
If the function returns true, the value is included otherwise it is filtered.
The function to be called, it will receive the args o (the object), k (the key)
(optional) The scope of the function (defaults to this)
Finds the index of the first matching object in this collection by a specific property/value.
The name of a property on your objects.
A string that the property values
should start with or a RegExp to test against the property.
(optional) The index to start searching at (defaults to 0).
(optional) True to match any part of the string, not just the beginning.
(optional) True for case sensitive comparison.
Find the index of the first matching object in this collection by a function.
If the function returns <i>true</i> it is considered a match.
The function to be called, it will receive the args o (the object), k (the key).
(optional) The scope of the function (defaults to this).
(optional) The index to start searching at (defaults to 0).
Creates a duplicate of this collection
Returns the item associated with the passed key or index.
The key or index of the item.
Abstract base class that provides a common interface for publishing events. Subclasses are expected to
to have a property "events" with all the events defined.<br>
For example:
<pre><code>Employee = function(name){
this.name = name;
this.addEvents({
"fired" : true,
"quit" : true
});
}
apf.extend(Employee, apf.util.Observable);</code></pre>
Fires the specified event with the passed parameters (minus the event name).
Variable number of parameters are passed to handlers
Appends an event handler to this component
The type of event to listen for
The method the event invokes
(optional) The scope in which to execute the handler
function. The handler function's "this" context.
(optional) An object containing handler configuration
properties. This may contain any of the following properties:<ul>
<li><b>scope</b> : Object<p class="sub-desc">The scope in which to execute the handler function. The handler function's "this" context.</p></li>
<li><b>delay</b> : Number<p class="sub-desc">The number of milliseconds to delay the invocation of the handler after the event fires.</p></li>
<li><b>single</b> : Boolean<p class="sub-desc">True to add a handler to handle just the next firing of the event, and then remove itself.</p></li>
<li><b>buffer</b> : Number<p class="sub-desc">Causes the handler to be scheduled to run in an <a ext:cls="apf.util.DelayedTask" href="output/apf.util.DelayedTask.html">apf.util.DelayedTask</a> delayed
by the specified number of milliseconds. If the event fires again within that time, the original
handler is <em>not</em> invoked, but the new handler is scheduled in its place.</p></li>
</ul><br>
<p>
<b>Combining Options</b><br>
Using the options argument, it is possible to combine different types of listeners:<br>
<br>
A normalized, delayed, one-time listener that auto stops the event and passes a custom argument (forumId)
<pre><code>el.on('click', this.onClick, this, {
single: true,
delay: 100,
forumId: 4
});</code></pre>
<p>
<b>Attaching multiple handlers in 1 call</b><br>
The method also allows for a single argument to be passed which is a config object containing properties
which specify multiple handlers.
<p>
<pre><code>foo.on({
'click' : {
fn: this.onClick,
scope: this,
delay: 100
},
'mouseover' : {
fn: this.onMouseOver,
scope: this
},
'mouseout' : {
fn: this.onMouseOut,
scope: this
}
});</code></pre>
<p>
Or a shorthand syntax:<br>
<pre><code>foo.on({
'click' : this.onClick,
'mouseover' : this.onMouseOver,
'mouseout' : this.onMouseOut,
scope: this
});</code></pre>
Removes a listener
The type of event to listen for
The handler to remove
(optional) The scope (this object) for the handler
Removes all listeners for this object
Relays selected events from the specified Observable as if the events were fired by <tt><b>this</b></tt>.
The Observable whose events this object is to relay.
Array of event names to relay.
Used to define events on this Observable
The object with the events defined
Checks to see if this object has any listeners for a specified event
The name of the event to check for
Suspend the firing of all events. (see <a ext:cls="apf.util.Observable" ext:member="resumeEvents" href="output/apf.util.Observable.html#resumeEvents">resumeEvents</a>)
Resume firing events. (see <a ext:cls="apf.util.Observable" ext:member="suspendEvents" href="output/apf.util.Observable.html#suspendEvents">suspendEvents</a>)
Appends an event handler to this element (shorthand for addListener)
The type of event to listen for
The method the event invokes
(optional) The scope in which to execute the handler
function. The handler function's "this" context.
(optional)
Removes a listener (shorthand for removeListener)
The type of event to listen for
The handler to remove
(optional) The scope (this object) for the handler
<static> Starts capture on the specified Observable. All events will be passed
to the supplied function with the event name + standard signature of the event
<b>before</b> the event is fired. If the supplied function returns false,
the event will not fire.
The Observable to capture
The function to call
(optional) The scope (this object) for the fn
<static> Removes <b>all</b> added captures from the Observable.
The Observable to release
Provides the ability to execute one or more arbitrary tasks in a multithreaded manner. Generally, you can use
the singleton <a ext:cls="apf.TaskMgr" href="output/apf.TaskMgr.html">apf.TaskMgr</a> instead, but if needed, you can create separate instances of TaskRunner. Any
number of separate tasks can be started at any time and will run independently of each other. Example usage:
<pre><code>// Start a simple clock task that updates a div once per second
var task = {
run: function(){
apf.fly('clock').update(new Date().format('g:i:s A'));
},
interval: 1000 //1 second
}
var runner = new apf.util.TaskRunner();
runner.start(task);</code></pre>
(optional) The minimum precision in milliseconds supported by this TaskRunner instance
(defaults to 10)
Starts a new task.
A config object that supports the following properties:<ul>
<li><code>run</code> : Function<div class="sub-desc">The function to execute each time the task is run. The
function will be called at each interval and passed the <code>args</code> argument if specified. If a
particular scope is required, be sure to specify it using the <code>scope</scope> argument.</div></li>
<li><code>interval</code> : Number<div class="sub-desc">The frequency in milliseconds with which the task
should be executed.</div></li>
<li><code>args</code> : Array<div class="sub-desc">(optional) An array of arguments to be passed to the function
specified by <code>run</code>.</div></li>
<li><code>scope</code> : Object<div class="sub-desc">(optional) The scope in which to execute the
<code>run</code> function.</div></li>
<li><code>duration</code> : Number<div class="sub-desc">(optional) The length of time in milliseconds to execute
the task before stopping automatically (defaults to indefinite).</div></li>
<li><code>repeat</code> : Number<div class="sub-desc">(optional) The number of times to execute the task before
stopping automatically (defaults to indefinite).</div></li>
</ul>
Stops an existing running task.
The task to stop
Stops all tasks that are currently running.
Provides precise pixel measurements for blocks of text so that you can determine exactly how high and
wide, in pixels, a given block of text will be.<br><br><i>This class is a singleton and cannot be created directly.</i>
Measures the size of the specified text
The element, dom node or id from which to copy existing CSS styles
that can affect the size of the rendered text
The text to measure
(optional) If the text will be multiline, you have to set a fixed width
in order to accurately measure the text height
Return a unique TextMetrics instance that can be bound directly to an element and reused. This reduces
the overhead of multiple calls to initialize the style properties on each measurement.
The element, dom node or id that the instance will be bound to
(optional) If the text will be multiline, you have to set a fixed width
in order to accurately measure the text height
Returns the size of the specified text based on the internal element's style and width properties
The text to measure
Binds this TextMetrics instance to an element from which to copy existing CSS styles
that can affect the size of the rendered text
The element, dom node or id
Sets a fixed width on the internal measurement element. If the text will be multiline, you have
to set a fixed width in order to accurately measure the text height.
The width to set on the element
Returns the measured width of the specified text
The text to measure
Returns the measured height of the specified text. For multiline text, be sure to call
<a ext:cls="apf.util.TextMetrics" ext:member="setFixedWidth" href="output/apf.util.TextMetrics.html#setFixedWidth">setFixedWidth</a> if necessary.
The text to measure
These functions are available on every Function object (any JavaScript function).
Creates a callback that passes arguments[0], arguments[1], arguments[2], ...
Call directly on any function. Example: <code>myFunction.createCallback(arg1, arg2)</code>
Will create a function that is bound to those 2 args. <b>If a specific scope is required in the
callback, use <a ext:cls="Function" ext:member="createDelegate" href="output/Function.html#createDelegate">createDelegate</a> instead.</b> The function returned by createCallback always
executes in the window scope.
<p>This method is required when you want to pass arguments to a callback function. If no arguments
are needed, you can simply pass a reference to the function as a callback (e.g., callback: myFn).
However, if you tried to pass a function with arguments (e.g., callback: myFn(arg1, arg2)) the function
would simply execute immediately when the code is parsed. Example usage:
<pre><code>var sayHi = function(name){
alert('Hi, ' + name);
}
// clicking the button alerts "Hi, Fred"
new apf.Button({
text: 'Say Hi',
renderTo: apf.getBody(),
handler: sayHi.createCallback('Fred')
});</code></pre>
Creates a delegate (callback) that sets the scope to obj.
Call directly on any function. Example: <code>this.myFunction.createDelegate(this, [arg1, arg2])</code>
Will create a function that is automatically scoped to obj so that the <tt>this</tt> variable inside the
callback points to obj. Example usage:
<pre><code>var sayHi = function(name){
// Note this use of "this.text" here. This function expects to
// execute within a scope that contains a text property. In this
// example, the "this" variable is pointing to the btn object that
// was passed in createDelegate below.
alert('Hi, ' + name + '. You clicked the "' + this.text + '" button.');
}
var btn = new apf.Button({
text: 'Say Hi',
renderTo: apf.getBody()
});
// This callback will execute in the scope of the
// button instance. Clicking the button alerts
// "Hi, Fred. You clicked the "Say Hi" button."
btn.on('click', sayHi.createDelegate(btn, ['Fred']));</code></pre>
(optional) The object for which the scope is set
(optional) Overrides arguments for the call. (Defaults to the arguments passed by the caller)
(optional) if True args are appended to call args instead of overriding,
if a number the args are inserted at the specified position
Calls this function after the number of millseconds specified, optionally in a specific scope. Example usage:
<pre><code>var sayHi = function(name){
alert('Hi, ' + name);
}
// executes immediately:
sayHi('Fred');
// executes after 2 seconds:
sayHi.defer(2000, this, ['Fred']);
// this syntax is sometimes useful for deferring
// execution of an anonymous function:
(function(){
alert('Anonymous');
}).defer(100);</code></pre>
The number of milliseconds for the setTimeout call (if 0 the function is executed immediately)
(optional) The object for which the scope is set
(optional) Overrides arguments for the call. (Defaults to the arguments passed by the caller)
(optional) if True args are appended to call args instead of overriding,
if a number the args are inserted at the specified position
Create a combined function call sequence of the original function + the passed function.
The resulting function returns the results of the original function.
The passed fcn is called with the parameters of the original function. Example usage:
<pre><code>var sayHi = function(name){
alert('Hi, ' + name);
}
sayHi('Fred'); // alerts "Hi, Fred"
var sayGoodbye = sayHi.createSequence(function(name){
alert('Bye, ' + name);
});
sayGoodbye('Fred'); // both alerts show</code></pre>
The function to sequence
(optional) The scope of the passed fcn (Defaults to scope of original function or window)
Creates an interceptor function. The passed fcn is called before the original one. If it returns false,
the original one is not called. The resulting function returns the results of the original function.
The passed fcn is called with the parameters of the original function. Example usage:
<pre><code>var sayHi = function(name){
alert('Hi, ' + name);
}
sayHi('Fred'); // alerts "Hi, Fred"
// create a new function that validates input without
// directly modifying the original function:
var sayHiToFriend = sayHi.createInterceptor(function(name){
return name == 'Brian';
});
sayHiToFriend('Fred'); // no alert
sayHiToFriend('Brian'); // alerts "Hi, Brian"</code></pre>
The function to call before the original
(optional) The scope of the passed fcn (Defaults to scope of original function or window)
Checks whether or not the current number is within a desired range. If the number is already within the
range it is returned, otherwise the min or max value is returned depending on which side of the range is
exceeded. Note that this method returns the constrained value but does not change the current number.
The minimum number in the range
The maximum number in the range
These functions are available as static methods on the JavaScript String object.
<static> Escapes the passed string for ' and \
The string to escape
<static> Pads the left side of a string with a specified character. This is especially useful
for normalizing number and date strings. Example usage:
<pre><code>var s = String.leftPad('123', 5, '0');
// s now contains the string: '00123'</code></pre>
The original string
The total length of the output string
(optional) The character with which to pad the original string (defaults to empty string " ")
<static> Allows you to define a tokenized string and pass an arbitrary number of arguments to replace the tokens. Each
token must be unique, and must increment in the format {0}, {1}, etc. Example usage:
<pre><code>var cls = 'my-class', text = 'Some text';
var s = String.format('<div class="{0}">{1}</div>', cls, text);
// s now contains the string: '<div class="my-class">Some text</div>'</code></pre>
The tokenized string to be formatted
The value to replace token {0}
Etc...
Utility function that allows you to easily switch a string between two alternating values. The passed value
is compared to the current string, and if they are equal, the other value that was passed in is returned. If
they are already different, the first value passed in is returned. Note that this method returns the new value
but does not change the current string.
<pre><code>// alternate sort directions
sort = sort.toggle('ASC', 'DESC');
// instead of conditional logic:
sort = (sort == 'ASC' ? 'DESC' : 'ASC');</code></pre>
The value to compare to the current string
The new value to use if the string already equals the first value passed in
Trims whitespace from either end of a string, leaving spaces within the string intact. Example:
<pre><code>var s = ' foo bar ';
alert('-' + s + '-'); //alerts "- foo bar -"
alert('-' + s.trim() + '-'); //alerts "-foo bar-"</code></pre>