Clear Up
SharpKit Reference

Stateful Interface

A mixin for being able to save the state of an object to an underlying Ext.state.Provider.

Namespace: Ext.state

Base Interfaces

Derived Types


Name Description
addStateEvents(object) Add events that will trigger the state to be saved. If the first argument is an array, each element of that array is the name of a state event. Otherwise, each argument passed to this method is the name of a state event.
applyState(object) Applies the state to the object. This should be overridden in subclasses to do more complex state operations. By default it applies the state properties onto the current object.
destroy() Destroys this stateful object. Overrides: Ext.Base.destroy
getState() Gets the current state of the object. By default this function returns null, it should be overridden in subclasses to implement methods for getting the state.
getStateId() Gets the state id for this object.
initState() Initializes the state of the object upon construction.
onStateChange() This method is called when any of the stateEvents are fired.
savePropsToState(object, object) Gathers additional named properties of the instance and adds their current values to the passed state object.
savePropToState(JsString, object, object) Conditionally saves a single property from this object to the given state object. The idea is to only save state which has changed from the initial state so that current software settings do not override future software settings. Only those values that are user-changed state should be saved.
saveState() Saves the state of the object to the persistence store.


Name Description
className Defaults to: "Ext.Base"
configMap Defaults to: {}
initConfigList Defaults to: []
initConfigMap Defaults to: {}
isInstance Defaults to: true
self Get the reference to the current class from which this object was instantiated. Unlike statics, this.self is scope-dependent and it's meant to be used for dynamic inheritance. See statics for a detailed comparison
  Ext.define('My.Cat', {
            statics: {
            speciesName: 'Cat' // My.Cat.speciesName = 'Cat'
            constructor: function() {
            alert(this.self.speciesName); // dependent on 'this'
            clone: function() {
            return new this.self();
            Ext.define('My.SnowLeopard', {
            extend: 'My.Cat',
            statics: {
            speciesName: 'Snow Leopard'         // My.SnowLeopard.speciesName = 'Snow Leopard'
            var cat = new My.Cat();                     // alerts 'Cat'
            var snowLeopard = new My.SnowLeopard();     // alerts 'Snow Leopard'
            var clone = snowLeopard.clone();
            alert(Ext.getClassName(clone));             // alerts 'My.SnowLeopard'
© Copyright 2005-2011 SharpKit. All rights reserved.