*/
/**
* @class Roo.data.MemoryProxy
+ * @extends Roo.data.DataProxy
* An implementation of Roo.data.DataProxy that simply passes the data specified in its constructor
* to the Reader when its load method is called.
* @constructor
- * @param {Object} data The data object which the Reader uses to construct a block of Roo.data.Records.
+ * @param {Object} config A config object containing the objects needed for the Store to access data,
*/
Roo.data.MemoryProxy = function(data){
- if (data.data) {
+ if (typeof(data) != 'undefined' && typeof(data.data) != 'undefined') {
data = data.data;
}
Roo.data.MemoryProxy.superclass.constructor.call(this);
Roo.extend(Roo.data.MemoryProxy, Roo.data.DataProxy, {
+ /**
+ * @cfg {Object} data The data object which the Reader uses to construct a block of Roo.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
"isAbstract" : true,
"isBuilderTop" : false,
"implementations" : [
- "Roo.data.HttpProxy"
+ "Roo.data.HttpProxy",
+ "Roo.data.MemoryProxy"
],
"tree_children" : [],
"tree_parent" : []
"tree_parent" : []
},
"Roo.data.MemoryProxy" : {
- "props" : [],
- "events" : [],
+ "props" : [
+ {
+ "name" : "data",
+ "type" : "Object",
+ "desc" : "The data object which the Reader uses to construct a block of Roo.data.Records.",
+ "memberOf" : "",
+ "isOptional" : false,
+ "optvals" : []
+ },
+ {
+ "name" : "listeners",
+ "type" : "Object",
+ "desc" : "list of events and functions to call for this object, \nFor example :\n<pre><code>\n listeners : { \n 'click' : function(e) {\n ..... \n } ,\n .... \n } \n </code></pre>",
+ "memberOf" : "Roo.util.Observable",
+ "isOptional" : false,
+ "optvals" : []
+ }
+ ],
+ "events" : [
+ {
+ "name" : "beforeload",
+ "type" : "function",
+ "desc" : "Fires before a network request is made to retrieve a data object.",
+ "sig" : "function (This, params)\n{\n\n}",
+ "memberOf" : "Roo.data.DataProxy",
+ "example" : "",
+ "deprecated" : "",
+ "since" : "",
+ "see" : "",
+ "params" : [
+ {
+ "name" : "This",
+ "type" : "Object",
+ "desc" : "DataProxy object.",
+ "isOptional" : false
+ },
+ {
+ "name" : "params",
+ "type" : "Object",
+ "desc" : "The params parameter to the load function.",
+ "isOptional" : false
+ }
+ ],
+ "returns" : []
+ },
+ {
+ "name" : "load",
+ "type" : "function",
+ "desc" : "Fires before the load method's callback is called.",
+ "sig" : "function (This, o, arg)\n{\n\n}",
+ "memberOf" : "Roo.data.DataProxy",
+ "example" : "",
+ "deprecated" : "",
+ "since" : "",
+ "see" : "",
+ "params" : [
+ {
+ "name" : "This",
+ "type" : "Object",
+ "desc" : "DataProxy object.",
+ "isOptional" : false
+ },
+ {
+ "name" : "o",
+ "type" : "Object",
+ "desc" : "The data object.",
+ "isOptional" : false
+ },
+ {
+ "name" : "arg",
+ "type" : "Object",
+ "desc" : "The callback argument object passed to the load function.",
+ "isOptional" : false
+ }
+ ],
+ "returns" : []
+ },
+ {
+ "name" : "loadexception",
+ "type" : "function",
+ "desc" : "Fires if an Exception occurs during data retrieval.",
+ "sig" : "function (This, o, arg, e)\n{\n\n}",
+ "memberOf" : "Roo.data.DataProxy",
+ "example" : "",
+ "deprecated" : "",
+ "since" : "",
+ "see" : "",
+ "params" : [
+ {
+ "name" : "This",
+ "type" : "Object",
+ "desc" : "DataProxy object.",
+ "isOptional" : false
+ },
+ {
+ "name" : "o",
+ "type" : "Object",
+ "desc" : "The data object.",
+ "isOptional" : false
+ },
+ {
+ "name" : "arg",
+ "type" : "Object",
+ "desc" : "The callback argument object passed to the load function.",
+ "isOptional" : false
+ },
+ {
+ "name" : "e",
+ "type" : "Object",
+ "desc" : "The Exception.",
+ "isOptional" : false
+ }
+ ],
+ "returns" : []
+ }
+ ],
"methods" : [
+ {
+ "name" : "addEvents",
+ "type" : "function",
+ "desc" : "Used to define events on this Observable",
+ "sig" : "(object)",
+ "static" : false,
+ "memberOf" : "Roo.util.Observable",
+ "isStatic" : false,
+ "isConstructor" : false,
+ "isPrivate" : false,
+ "example" : "",
+ "deprecated" : "",
+ "since" : "",
+ "see" : "",
+ "exceptions" : "",
+ "requires" : "",
+ "params" : [
+ {
+ "name" : "object",
+ "type" : "Object",
+ "desc" : "The object with the events defined",
+ "isOptional" : false
+ }
+ ],
+ "returns" : []
+ },
+ {
+ "name" : "addListener",
+ "type" : "function",
+ "desc" : "Appends an event handler to this component",
+ "sig" : "(eventName, handler, scope, options)",
+ "static" : false,
+ "memberOf" : "Roo.util.Observable",
+ "isStatic" : false,
+ "isConstructor" : false,
+ "isPrivate" : false,
+ "example" : "",
+ "deprecated" : "",
+ "since" : "",
+ "see" : "",
+ "exceptions" : "",
+ "requires" : "",
+ "params" : [
+ {
+ "name" : "eventName",
+ "type" : "String",
+ "desc" : "The type of event to listen for",
+ "isOptional" : false
+ },
+ {
+ "name" : "handler",
+ "type" : "Function",
+ "desc" : "The method the event invokes",
+ "isOptional" : false
+ },
+ {
+ "name" : "scope",
+ "type" : "Object",
+ "desc" : "(optional) The scope in which to execute the handler\nfunction. The handler function's \"this\" context.",
+ "isOptional" : false
+ },
+ {
+ "name" : "options",
+ "type" : "Object",
+ "desc" : "(optional) An object containing handler configuration\nproperties. This may contain any of the following properties:<ul>\n<li>scope {Object} The scope in which to execute the handler function. The handler function's \"this\" context.</li>\n<li>delay {Number} The number of milliseconds to delay the invocation of the handler after te event fires.</li>\n<li>single {Boolean} True to add a handler to handle just the next firing of the event, and then remove itself.</li>\n<li>buffer {Number} Causes the handler to be scheduled to run in an {@link Roo.util.DelayedTask} delayed\nby the specified number of milliseconds. If the event fires again within that time, the original\nhandler is <em>not</em> invoked, but the new handler is scheduled in its place.</li>\n</ul><br>\n<p>\n<b>Combining Options</b><br>\nUsing the options argument, it is possible to combine different types of listeners:<br>\n<br>\nA normalized, delayed, one-time listener that auto stops the event and passes a custom argument (forumId)\n\t\t<pre><code>\n\t\tel.on('click', this.onClick, this, {\n \t\t\tsingle: true,\n \t\tdelay: 100,\n \t\tforumId: 4\n\t\t});\n\t\t</code></pre>\n<p>\n<b>Attaching multiple handlers in 1 call</b><br>\nThe method also allows for a single argument to be passed which is a config object containing properties\nwhich specify multiple handlers.\n<pre><code>\n\t\tel.on({\n\t\t\t'click': {\n \t\tfn: this.onClick,\n \t\tscope: this,\n \t\tdelay: 100\n \t\t}, \n \t\t'mouseover': {\n \t\tfn: this.onMouseOver,\n \t\tscope: this\n \t\t},\n \t\t'mouseout': {\n \t\tfn: this.onMouseOut,\n \t\tscope: this\n \t\t}\n\t\t});\n\t\t</code></pre>\n<p>\nOr a shorthand syntax which passes the same scope object to all handlers:\n \t<pre><code>\n\t\tel.on({\n\t\t\t'click': this.onClick,\n \t\t'mouseover': this.onMouseOver,\n \t\t'mouseout': this.onMouseOut,\n \t\tscope: this\n\t\t});\n\t\t</code></pre>",
+ "isOptional" : false
+ }
+ ],
+ "returns" : []
+ },
+ {
+ "name" : "capture",
+ "type" : "function",
+ "desc" : "Starts capture on the specified Observable. All events will be passed\nto the supplied function with the event name + standard signature of the event\n<b>before</b> the event is fired. If the supplied function returns false,\nthe event will not fire.",
+ "sig" : "(o, fn, scope)",
+ "static" : true,
+ "memberOf" : "Roo.util.Observable",
+ "isStatic" : true,
+ "isConstructor" : false,
+ "isPrivate" : false,
+ "example" : "",
+ "deprecated" : "",
+ "since" : "",
+ "see" : "",
+ "exceptions" : "",
+ "requires" : "",
+ "params" : [
+ {
+ "name" : "o",
+ "type" : "Observable",
+ "desc" : "The Observable to capture",
+ "isOptional" : false
+ },
+ {
+ "name" : "fn",
+ "type" : "Function",
+ "desc" : "The function to call",
+ "isOptional" : false
+ },
+ {
+ "name" : "scope",
+ "type" : "Object",
+ "desc" : "(optional) The scope (this object) for the fn",
+ "isOptional" : false
+ }
+ ],
+ "returns" : []
+ },
+ {
+ "name" : "fireEvent",
+ "type" : "function",
+ "desc" : "Fires the specified event with the passed parameters (minus the event name).",
+ "sig" : "(eventName, args)",
+ "static" : false,
+ "memberOf" : "Roo.util.Observable",
+ "isStatic" : false,
+ "isConstructor" : false,
+ "isPrivate" : false,
+ "example" : "",
+ "deprecated" : "",
+ "since" : "",
+ "see" : "",
+ "exceptions" : "",
+ "requires" : "",
+ "params" : [
+ {
+ "name" : "eventName",
+ "type" : "String",
+ "desc" : "",
+ "isOptional" : false
+ },
+ {
+ "name" : "args",
+ "type" : "Object...",
+ "desc" : "Variable number of parameters are passed to handlers",
+ "isOptional" : false
+ }
+ ],
+ "returns" : [
+ {
+ "name" : "",
+ "type" : "Boolean",
+ "desc" : "returns false if any of the handlers return false otherwise it returns true"
+ }
+ ]
+ },
+ {
+ "name" : "hasListener",
+ "type" : "function",
+ "desc" : "Checks to see if this object has any listeners for a specified event",
+ "sig" : "(eventName)",
+ "static" : false,
+ "memberOf" : "Roo.util.Observable",
+ "isStatic" : false,
+ "isConstructor" : false,
+ "isPrivate" : false,
+ "example" : "",
+ "deprecated" : "",
+ "since" : "",
+ "see" : "",
+ "exceptions" : "",
+ "requires" : "",
+ "params" : [
+ {
+ "name" : "eventName",
+ "type" : "String",
+ "desc" : "The name of the event to check for",
+ "isOptional" : false
+ }
+ ],
+ "returns" : [
+ {
+ "name" : "",
+ "type" : "Boolean",
+ "desc" : "True if the event is being listened for, else false"
+ }
+ ]
+ },
{
"name" : "load",
"type" : "function",
}
],
"returns" : []
+ },
+ {
+ "name" : "on",
+ "type" : "function",
+ "desc" : "Appends an event handler to this element (shorthand for addListener)",
+ "sig" : "(eventName, handler, scope, options)",
+ "static" : false,
+ "memberOf" : "Roo.util.Observable",
+ "isStatic" : false,
+ "isConstructor" : false,
+ "isPrivate" : false,
+ "example" : "",
+ "deprecated" : "",
+ "since" : "",
+ "see" : "",
+ "exceptions" : "",
+ "requires" : "",
+ "params" : [
+ {
+ "name" : "eventName",
+ "type" : "String",
+ "desc" : "The type of event to listen for",
+ "isOptional" : false
+ },
+ {
+ "name" : "handler",
+ "type" : "Function",
+ "desc" : "The method the event invokes",
+ "isOptional" : false
+ },
+ {
+ "name" : "scope",
+ "type" : "Object",
+ "desc" : "(optional) The scope in which to execute the handler\nfunction. The handler function's \"this\" context.",
+ "isOptional" : false
+ },
+ {
+ "name" : "options",
+ "type" : "Object",
+ "desc" : "(optional)",
+ "isOptional" : false
+ }
+ ],
+ "returns" : []
+ },
+ {
+ "name" : "purgeListeners",
+ "type" : "function",
+ "desc" : "Removes all listeners for this object",
+ "sig" : "()\n{\n\n}",
+ "static" : false,
+ "memberOf" : "Roo.util.Observable",
+ "isStatic" : false,
+ "isConstructor" : false,
+ "isPrivate" : false,
+ "example" : "",
+ "deprecated" : "",
+ "since" : "",
+ "see" : "",
+ "exceptions" : "",
+ "requires" : "",
+ "params" : [],
+ "returns" : []
+ },
+ {
+ "name" : "releaseCapture",
+ "type" : "function",
+ "desc" : "Removes <b>all</b> added captures from the Observable.",
+ "sig" : "(o)",
+ "static" : true,
+ "memberOf" : "Roo.util.Observable",
+ "isStatic" : true,
+ "isConstructor" : false,
+ "isPrivate" : false,
+ "example" : "",
+ "deprecated" : "",
+ "since" : "",
+ "see" : "",
+ "exceptions" : "",
+ "requires" : "",
+ "params" : [
+ {
+ "name" : "o",
+ "type" : "Observable",
+ "desc" : "The Observable to release",
+ "isOptional" : false
+ }
+ ],
+ "returns" : []
+ },
+ {
+ "name" : "removeListener",
+ "type" : "function",
+ "desc" : "Removes a listener",
+ "sig" : "(eventName, handler, scope)",
+ "static" : false,
+ "memberOf" : "Roo.util.Observable",
+ "isStatic" : false,
+ "isConstructor" : false,
+ "isPrivate" : false,
+ "example" : "",
+ "deprecated" : "",
+ "since" : "",
+ "see" : "",
+ "exceptions" : "",
+ "requires" : "",
+ "params" : [
+ {
+ "name" : "eventName",
+ "type" : "String",
+ "desc" : "The type of event to listen for",
+ "isOptional" : false
+ },
+ {
+ "name" : "handler",
+ "type" : "Function",
+ "desc" : "The handler to remove",
+ "isOptional" : false
+ },
+ {
+ "name" : "scope",
+ "type" : "Object",
+ "desc" : "(optional) The scope (this object) for the handler",
+ "isOptional" : false
+ }
+ ],
+ "returns" : []
+ },
+ {
+ "name" : "un",
+ "type" : "function",
+ "desc" : "Removes a listener (shorthand for removeListener)",
+ "sig" : "(eventName, handler, scope)",
+ "static" : false,
+ "memberOf" : "Roo.util.Observable",
+ "isStatic" : false,
+ "isConstructor" : false,
+ "isPrivate" : false,
+ "example" : "",
+ "deprecated" : "",
+ "since" : "",
+ "see" : "",
+ "exceptions" : "",
+ "requires" : "",
+ "params" : [
+ {
+ "name" : "eventName",
+ "type" : "String",
+ "desc" : "The type of event to listen for",
+ "isOptional" : false
+ },
+ {
+ "name" : "handler",
+ "type" : "Function",
+ "desc" : "The handler to remove",
+ "isOptional" : false
+ },
+ {
+ "name" : "scope",
+ "type" : "Object",
+ "desc" : "(optional) The scope (this object) for the handler",
+ "isOptional" : false
+ }
+ ],
+ "returns" : []
}
],
"isAbstract" : false,
"Roo.data.DataProxy",
"Roo.data.HttpProxy",
"Roo.data.JsonStore",
+ "Roo.data.MemoryProxy",
"Roo.data.Node",
"Roo.data.SimpleStore",
"Roo.data.Store",
*/
/**
* @class Roo.data.MemoryProxy
+ * @extends Roo.data.DataProxy
* An implementation of Roo.data.DataProxy that simply passes the data specified in its constructor
* to the Reader when its load method is called.
* @constructor
- * @param {Object} data The data object which the Reader uses to construct a block of Roo.data.Records.
+ * @param {Object} config A config object containing the objects needed for the Store to access data,
*/
</span><span class="jsdoc-var">Roo.data.MemoryProxy </span><span class="jsdoc-syntax">= </span><span class="jsdoc-keyword">function</span><span class="jsdoc-syntax">(</span><span class="jsdoc-var">data</span><span class="jsdoc-syntax">){
- </span><span class="jsdoc-keyword">if </span><span class="jsdoc-syntax">(</span><span class="jsdoc-var">data.data</span><span class="jsdoc-syntax">) {
+ </span><span class="jsdoc-keyword">if </span><span class="jsdoc-syntax">(</span><span class="jsdoc-keyword">typeof</span><span class="jsdoc-syntax">(</span><span class="jsdoc-var">data</span><span class="jsdoc-syntax">) != </span><span class="jsdoc-string">'undefined' </span><span class="jsdoc-syntax">&& </span><span class="jsdoc-keyword">typeof</span><span class="jsdoc-syntax">(</span><span class="jsdoc-var">data.data</span><span class="jsdoc-syntax">) != </span><span class="jsdoc-string">'undefined'</span><span class="jsdoc-syntax">) {
</span><span class="jsdoc-var">data </span><span class="jsdoc-syntax">= </span><span class="jsdoc-var">data.data</span><span class="jsdoc-syntax">;
}
</span><span class="jsdoc-var">Roo.data.MemoryProxy.superclass.constructor.call</span><span class="jsdoc-syntax">(</span><span class="jsdoc-var">this</span><span class="jsdoc-syntax">);
</span><span class="jsdoc-var">Roo.extend</span><span class="jsdoc-syntax">(</span><span class="jsdoc-var">Roo.data.MemoryProxy</span><span class="jsdoc-syntax">, </span><span class="jsdoc-var">Roo.data.DataProxy</span><span class="jsdoc-syntax">, {
</span><span class="jsdoc-comment">/**
+ * @cfg {Object} data The data object which the Reader uses to construct a block of Roo.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 Roo.data.Records using the passed Roo.data.DataReader implementation, and
],
"childClasses" : {
"Roo.data.DataProxy" : [
- "Roo.data.HttpProxy"
+ "Roo.data.HttpProxy",
+ "Roo.data.MemoryProxy"
]
},
"tree_children" : [],
{
"name" : "Roo.data.MemoryProxy",
- "augments" : [],
+ "augments" : [
+ "Roo.data.DataProxy",
+ "Roo.util.Observable"
+ ],
"childClasses" : { },
"tree_children" : [],
"tree_parent" : [],
"see" : "",
"params" : [
{
- "name" : "data",
+ "name" : "config",
"type" : "Object",
- "desc" : "The data object which the Reader uses to construct a block of Roo.data.Records.",
+ "desc" : "A config object containing the objects needed for the Store to access data,",
"isOptional" : false
}
],
"returns" : [],
"throws" : "",
"requires" : "",
- "config" : [],
+ "config" : [
+ {
+ "name" : "listeners",
+ "type" : "Object",
+ "desc" : "list of events and functions to call for this object, \nFor example :\n<pre><code>\n listeners : { \n 'click' : function(e) {\n ..... \n } ,\n .... \n } \n </code></pre>",
+ "memberOf" : "Roo.util.Observable",
+ "isOptional" : false,
+ "optvals" : []
+ },
+ {
+ "name" : "data",
+ "type" : "Object",
+ "desc" : "The data object which the Reader uses to construct a block of Roo.data.Records.",
+ "memberOf" : "",
+ "isOptional" : false,
+ "optvals" : []
+ }
+ ],
"methods" : [
{
"name" : "load",
}
],
"returns" : []
+ },
+ {
+ "name" : "purgeListeners",
+ "type" : "function",
+ "desc" : "Removes all listeners for this object",
+ "sig" : "()\n{\n\n}",
+ "static" : false,
+ "memberOf" : "Roo.util.Observable",
+ "isStatic" : false,
+ "isConstructor" : false,
+ "isPrivate" : false,
+ "example" : "",
+ "deprecated" : "",
+ "since" : "",
+ "see" : "",
+ "exceptions" : "",
+ "requires" : "",
+ "params" : [],
+ "returns" : []
+ },
+ {
+ "name" : "on",
+ "type" : "function",
+ "desc" : "Appends an event handler to this element (shorthand for addListener)",
+ "sig" : "(eventName, handler, scope, options)",
+ "static" : false,
+ "memberOf" : "Roo.util.Observable",
+ "isStatic" : false,
+ "isConstructor" : false,
+ "isPrivate" : false,
+ "example" : "",
+ "deprecated" : "",
+ "since" : "",
+ "see" : "",
+ "exceptions" : "",
+ "requires" : "",
+ "params" : [
+ {
+ "name" : "eventName",
+ "type" : "String",
+ "desc" : "The type of event to listen for",
+ "isOptional" : false
+ },
+ {
+ "name" : "handler",
+ "type" : "Function",
+ "desc" : "The method the event invokes",
+ "isOptional" : false
+ },
+ {
+ "name" : "scope",
+ "type" : "Object",
+ "desc" : "(optional) The scope in which to execute the handler\nfunction. The handler function's \"this\" context.",
+ "isOptional" : false
+ },
+ {
+ "name" : "options",
+ "type" : "Object",
+ "desc" : "(optional)",
+ "isOptional" : false
+ }
+ ],
+ "returns" : []
+ },
+ {
+ "name" : "un",
+ "type" : "function",
+ "desc" : "Removes a listener (shorthand for removeListener)",
+ "sig" : "(eventName, handler, scope)",
+ "static" : false,
+ "memberOf" : "Roo.util.Observable",
+ "isStatic" : false,
+ "isConstructor" : false,
+ "isPrivate" : false,
+ "example" : "",
+ "deprecated" : "",
+ "since" : "",
+ "see" : "",
+ "exceptions" : "",
+ "requires" : "",
+ "params" : [
+ {
+ "name" : "eventName",
+ "type" : "String",
+ "desc" : "The type of event to listen for",
+ "isOptional" : false
+ },
+ {
+ "name" : "handler",
+ "type" : "Function",
+ "desc" : "The handler to remove",
+ "isOptional" : false
+ },
+ {
+ "name" : "scope",
+ "type" : "Object",
+ "desc" : "(optional) The scope (this object) for the handler",
+ "isOptional" : false
+ }
+ ],
+ "returns" : []
+ },
+ {
+ "name" : "addEvents",
+ "type" : "function",
+ "desc" : "Used to define events on this Observable",
+ "sig" : "(object)",
+ "static" : false,
+ "memberOf" : "Roo.util.Observable",
+ "isStatic" : false,
+ "isConstructor" : false,
+ "isPrivate" : false,
+ "example" : "",
+ "deprecated" : "",
+ "since" : "",
+ "see" : "",
+ "exceptions" : "",
+ "requires" : "",
+ "params" : [
+ {
+ "name" : "object",
+ "type" : "Object",
+ "desc" : "The object with the events defined",
+ "isOptional" : false
+ }
+ ],
+ "returns" : []
+ },
+ {
+ "name" : "releaseCapture",
+ "type" : "function",
+ "desc" : "Removes <b>all</b> added captures from the Observable.",
+ "sig" : "(o)",
+ "static" : true,
+ "memberOf" : "Roo.util.Observable",
+ "isStatic" : true,
+ "isConstructor" : false,
+ "isPrivate" : false,
+ "example" : "",
+ "deprecated" : "",
+ "since" : "",
+ "see" : "",
+ "exceptions" : "",
+ "requires" : "",
+ "params" : [
+ {
+ "name" : "o",
+ "type" : "Observable",
+ "desc" : "The Observable to release",
+ "isOptional" : false
+ }
+ ],
+ "returns" : []
+ },
+ {
+ "name" : "removeListener",
+ "type" : "function",
+ "desc" : "Removes a listener",
+ "sig" : "(eventName, handler, scope)",
+ "static" : false,
+ "memberOf" : "Roo.util.Observable",
+ "isStatic" : false,
+ "isConstructor" : false,
+ "isPrivate" : false,
+ "example" : "",
+ "deprecated" : "",
+ "since" : "",
+ "see" : "",
+ "exceptions" : "",
+ "requires" : "",
+ "params" : [
+ {
+ "name" : "eventName",
+ "type" : "String",
+ "desc" : "The type of event to listen for",
+ "isOptional" : false
+ },
+ {
+ "name" : "handler",
+ "type" : "Function",
+ "desc" : "The handler to remove",
+ "isOptional" : false
+ },
+ {
+ "name" : "scope",
+ "type" : "Object",
+ "desc" : "(optional) The scope (this object) for the handler",
+ "isOptional" : false
+ }
+ ],
+ "returns" : []
+ },
+ {
+ "name" : "fireEvent",
+ "type" : "function",
+ "desc" : "Fires the specified event with the passed parameters (minus the event name).",
+ "sig" : "(eventName, args)",
+ "static" : false,
+ "memberOf" : "Roo.util.Observable",
+ "isStatic" : false,
+ "isConstructor" : false,
+ "isPrivate" : false,
+ "example" : "",
+ "deprecated" : "",
+ "since" : "",
+ "see" : "",
+ "exceptions" : "",
+ "requires" : "",
+ "params" : [
+ {
+ "name" : "eventName",
+ "type" : "String",
+ "desc" : "",
+ "isOptional" : false
+ },
+ {
+ "name" : "args",
+ "type" : "Object...",
+ "desc" : "Variable number of parameters are passed to handlers",
+ "isOptional" : false
+ }
+ ],
+ "returns" : [
+ {
+ "name" : "",
+ "type" : "Boolean",
+ "desc" : "returns false if any of the handlers return false otherwise it returns true"
+ }
+ ]
+ },
+ {
+ "name" : "hasListener",
+ "type" : "function",
+ "desc" : "Checks to see if this object has any listeners for a specified event",
+ "sig" : "(eventName)",
+ "static" : false,
+ "memberOf" : "Roo.util.Observable",
+ "isStatic" : false,
+ "isConstructor" : false,
+ "isPrivate" : false,
+ "example" : "",
+ "deprecated" : "",
+ "since" : "",
+ "see" : "",
+ "exceptions" : "",
+ "requires" : "",
+ "params" : [
+ {
+ "name" : "eventName",
+ "type" : "String",
+ "desc" : "The name of the event to check for",
+ "isOptional" : false
+ }
+ ],
+ "returns" : [
+ {
+ "name" : "",
+ "type" : "Boolean",
+ "desc" : "True if the event is being listened for, else false"
+ }
+ ]
+ },
+ {
+ "name" : "capture",
+ "type" : "function",
+ "desc" : "Starts capture on the specified Observable. All events will be passed\nto the supplied function with the event name + standard signature of the event\n<b>before</b> the event is fired. If the supplied function returns false,\nthe event will not fire.",
+ "sig" : "(o, fn, scope)",
+ "static" : true,
+ "memberOf" : "Roo.util.Observable",
+ "isStatic" : true,
+ "isConstructor" : false,
+ "isPrivate" : false,
+ "example" : "",
+ "deprecated" : "",
+ "since" : "",
+ "see" : "",
+ "exceptions" : "",
+ "requires" : "",
+ "params" : [
+ {
+ "name" : "o",
+ "type" : "Observable",
+ "desc" : "The Observable to capture",
+ "isOptional" : false
+ },
+ {
+ "name" : "fn",
+ "type" : "Function",
+ "desc" : "The function to call",
+ "isOptional" : false
+ },
+ {
+ "name" : "scope",
+ "type" : "Object",
+ "desc" : "(optional) The scope (this object) for the fn",
+ "isOptional" : false
+ }
+ ],
+ "returns" : []
+ },
+ {
+ "name" : "addListener",
+ "type" : "function",
+ "desc" : "Appends an event handler to this component",
+ "sig" : "(eventName, handler, scope, options)",
+ "static" : false,
+ "memberOf" : "Roo.util.Observable",
+ "isStatic" : false,
+ "isConstructor" : false,
+ "isPrivate" : false,
+ "example" : "",
+ "deprecated" : "",
+ "since" : "",
+ "see" : "",
+ "exceptions" : "",
+ "requires" : "",
+ "params" : [
+ {
+ "name" : "eventName",
+ "type" : "String",
+ "desc" : "The type of event to listen for",
+ "isOptional" : false
+ },
+ {
+ "name" : "handler",
+ "type" : "Function",
+ "desc" : "The method the event invokes",
+ "isOptional" : false
+ },
+ {
+ "name" : "scope",
+ "type" : "Object",
+ "desc" : "(optional) The scope in which to execute the handler\nfunction. The handler function's \"this\" context.",
+ "isOptional" : false
+ },
+ {
+ "name" : "options",
+ "type" : "Object",
+ "desc" : "(optional) An object containing handler configuration\nproperties. This may contain any of the following properties:<ul>\n<li>scope {Object} The scope in which to execute the handler function. The handler function's \"this\" context.</li>\n<li>delay {Number} The number of milliseconds to delay the invocation of the handler after te event fires.</li>\n<li>single {Boolean} True to add a handler to handle just the next firing of the event, and then remove itself.</li>\n<li>buffer {Number} Causes the handler to be scheduled to run in an {@link Roo.util.DelayedTask} delayed\nby the specified number of milliseconds. If the event fires again within that time, the original\nhandler is <em>not</em> invoked, but the new handler is scheduled in its place.</li>\n</ul><br>\n<p>\n<b>Combining Options</b><br>\nUsing the options argument, it is possible to combine different types of listeners:<br>\n<br>\nA normalized, delayed, one-time listener that auto stops the event and passes a custom argument (forumId)\n\t\t<pre><code>\n\t\tel.on('click', this.onClick, this, {\n \t\t\tsingle: true,\n \t\tdelay: 100,\n \t\tforumId: 4\n\t\t});\n\t\t</code></pre>\n<p>\n<b>Attaching multiple handlers in 1 call</b><br>\nThe method also allows for a single argument to be passed which is a config object containing properties\nwhich specify multiple handlers.\n<pre><code>\n\t\tel.on({\n\t\t\t'click': {\n \t\tfn: this.onClick,\n \t\tscope: this,\n \t\tdelay: 100\n \t\t}, \n \t\t'mouseover': {\n \t\tfn: this.onMouseOver,\n \t\tscope: this\n \t\t},\n \t\t'mouseout': {\n \t\tfn: this.onMouseOut,\n \t\tscope: this\n \t\t}\n\t\t});\n\t\t</code></pre>\n<p>\nOr a shorthand syntax which passes the same scope object to all handlers:\n \t<pre><code>\n\t\tel.on({\n\t\t\t'click': this.onClick,\n \t\t'mouseover': this.onMouseOver,\n \t\t'mouseout': this.onMouseOut,\n \t\tscope: this\n\t\t});\n\t\t</code></pre>",
+ "isOptional" : false
+ }
+ ],
+ "returns" : []
}
],
- "events" : []
+ "events" : [
+ {
+ "name" : "load",
+ "type" : "function",
+ "desc" : "Fires before the load method's callback is called.",
+ "sig" : "function (This, o, arg)\n{\n\n}",
+ "memberOf" : "Roo.data.DataProxy",
+ "example" : "",
+ "deprecated" : "",
+ "since" : "",
+ "see" : "",
+ "params" : [
+ {
+ "name" : "This",
+ "type" : "Object",
+ "desc" : "DataProxy object.",
+ "isOptional" : false
+ },
+ {
+ "name" : "o",
+ "type" : "Object",
+ "desc" : "The data object.",
+ "isOptional" : false
+ },
+ {
+ "name" : "arg",
+ "type" : "Object",
+ "desc" : "The callback argument object passed to the load function.",
+ "isOptional" : false
+ }
+ ],
+ "returns" : []
+ },
+ {
+ "name" : "beforeload",
+ "type" : "function",
+ "desc" : "Fires before a network request is made to retrieve a data object.",
+ "sig" : "function (This, params)\n{\n\n}",
+ "memberOf" : "Roo.data.DataProxy",
+ "example" : "",
+ "deprecated" : "",
+ "since" : "",
+ "see" : "",
+ "params" : [
+ {
+ "name" : "This",
+ "type" : "Object",
+ "desc" : "DataProxy object.",
+ "isOptional" : false
+ },
+ {
+ "name" : "params",
+ "type" : "Object",
+ "desc" : "The params parameter to the load function.",
+ "isOptional" : false
+ }
+ ],
+ "returns" : []
+ },
+ {
+ "name" : "loadexception",
+ "type" : "function",
+ "desc" : "Fires if an Exception occurs during data retrieval.",
+ "sig" : "function (This, o, arg, e)\n{\n\n}",
+ "memberOf" : "Roo.data.DataProxy",
+ "example" : "",
+ "deprecated" : "",
+ "since" : "",
+ "see" : "",
+ "params" : [
+ {
+ "name" : "This",
+ "type" : "Object",
+ "desc" : "DataProxy object.",
+ "isOptional" : false
+ },
+ {
+ "name" : "o",
+ "type" : "Object",
+ "desc" : "The data object.",
+ "isOptional" : false
+ },
+ {
+ "name" : "arg",
+ "type" : "Object",
+ "desc" : "The callback argument object passed to the load function.",
+ "isOptional" : false
+ },
+ {
+ "name" : "e",
+ "type" : "Object",
+ "desc" : "The Exception.",
+ "isOptional" : false
+ }
+ ],
+ "returns" : []
+ }
+ ]
}
\ No newline at end of file
"Roo.JsonView"
],
"Roo.data.DataProxy" : [
- "Roo.data.HttpProxy"
+ "Roo.data.HttpProxy",
+ "Roo.data.MemoryProxy"
],
"Roo.menu.Menu" : [
"Roo.menu.ColorMenu",
--- /dev/null
+{
+ "name" : "ArrayGrid",
+ "parent" : "#grid-panel",
+ "title" : "",
+ "path" : "/home/alan/gitlive/roojs1/examples/grid/ArrayGrid.bjs",
+ "permname" : "",
+ "modOrder" : "001",
+ "strings" : {
+ "1c76cbfe21c6f44c1d1e59d54f3e4420" : "Company",
+ "30870648ed968ed5a3e00631e4ad0699" : "% Change",
+ "3601146c4e948c32b6424d2c0a7f0118" : "Price",
+ "f4ec5f57bd4d31b803312d873be40da9" : "Change",
+ "4221d3e17c6eca2ca6337251a3cf9c4e" : "Last Updated"
+ },
+ "items" : [
+ {
+ "xtype" : "GridPanel",
+ "$ xns" : "Roo",
+ "items" : [
+ {
+ "listeners" : {
+ "render" : "function (grid)\n{\n _this.grid = this;\n}"
+ },
+ "xtype" : "Grid",
+ "$ xns" : "Roo.grid",
+ "String autoExpandColumn" : "company",
+ "* prop" : "grid",
+ "items" : [
+ {
+ "xtype" : "Store",
+ "$ xns" : "Roo.data",
+ "* prop" : "ds",
+ "items" : [
+ {
+ "xtype" : "MemoryProxy",
+ "$ data" : "[]",
+ "$ xns" : "Roo.data",
+ "* prop" : "proxy"
+ },
+ {
+ "$ Array fields" : "[\n {name: 'company'},\n {name: 'price', type: 'float'}, \n {name: 'change', type: 'float'},\n {name: 'pctChange', type: 'float'},\n {name: 'lastChange', type: 'date', dateFormat: 'n/j h:ia'}\n]",
+ "xtype" : "ArrayReader",
+ "$ xns" : "Roo.data",
+ "* prop" : "reader"
+ }
+ ]
+ },
+ {
+ "String header" : "Company",
+ "String dataIndex" : "company",
+ "Number width" : 160,
+ "xtype" : "ColumnModel",
+ "$ xns" : "Roo.grid",
+ "Boolean sortable" : true,
+ "* prop" : "cm[]",
+ "Boolean locked" : false
+ },
+ {
+ "String header" : "Price",
+ "String dataIndex" : "price",
+ "Number width" : 75,
+ "$ Function renderer" : " Roo.util.Format.usMoney",
+ "xtype" : "ColumnModel",
+ "$ xns" : "Roo.grid",
+ "Boolean sortable" : true,
+ "* prop" : "cm[]",
+ "Boolean locked" : false
+ },
+ {
+ "String header" : "Change",
+ "String dataIndex" : "change",
+ "Number width" : 75,
+ "$ Function renderer" : "function (val){\n if(val > 0){\n return '<span style=\"color:green;\">' + val + '</span>';\n }else if(val < 0){\n return '<span style=\"color:red;\">' + val + '</span>';\n }\n return val;\n}",
+ "xtype" : "ColumnModel",
+ "$ xns" : "Roo.grid",
+ "Boolean sortable" : true,
+ "* prop" : "cm[]",
+ "Boolean locked" : false
+ },
+ {
+ "String header" : "% Change",
+ "String dataIndex" : "pctChange",
+ "Number width" : 75,
+ "$ Function renderer" : "function (val){\n if(val > 0){\n return '<span style=\"color:green;\">' + val + '%</span>';\n }else if(val < 0){\n return '<span style=\"color:red;\">' + val + '%</span>';\n }\n return val;\n}",
+ "xtype" : "ColumnModel",
+ "$ xns" : "Roo.grid",
+ "Boolean sortable" : true,
+ "* prop" : "cm[]",
+ "Boolean locked" : false
+ },
+ {
+ "String header" : "Last Updated",
+ "String dataIndex" : "lastChange",
+ "Number width" : 85,
+ "$ Function renderer" : "Roo.util.Format.dateRenderer('m/d/Y')",
+ "xtype" : "ColumnModel",
+ "$ xns" : "Roo.grid",
+ "Boolean sortable" : true,
+ "* prop" : "cm[]",
+ "Boolean locked" : false
+ }
+ ]
+ }
+ ]
+ }
+ ]
+}
\ No newline at end of file
--- /dev/null
+//<script type="text/javascript">
+
+// Auto generated file - created by app.Builder.js- do not edit directly (at present!)
+
+ArrayGrid = new Roo.XComponent({
+
+ _strings : {
+ '1c76cbfe21c6f44c1d1e59d54f3e4420' :"Company",
+ '30870648ed968ed5a3e00631e4ad0699' :"% Change",
+ '3601146c4e948c32b6424d2c0a7f0118' :"Price",
+ 'f4ec5f57bd4d31b803312d873be40da9' :"Change",
+ '4221d3e17c6eca2ca6337251a3cf9c4e' :"Last Updated"
+ },
+
+ part : ["grid", "ArrayGrid" ],
+ order : '001-ArrayGrid',
+ region : 'center',
+ parent : '#grid-panel',
+ name : "unnamed module",
+ disabled : false,
+ permname : '',
+ _tree : function(_data)
+ {
+ var _this = this;
+ var MODULE = this;
+ return {
+ xtype : 'GridPanel',
+ xns : Roo,
+ '|xns' : 'Roo',
+ grid : {
+ xtype : 'Grid',
+ autoExpandColumn : 'company',
+ listeners : {
+ render : function (grid)
+ {
+ _this.grid = this;
+ }
+ },
+ xns : Roo.grid,
+ '|xns' : 'Roo.grid',
+ ds : {
+ xtype : 'Store',
+ xns : Roo.data,
+ '|xns' : 'Roo.data',
+ proxy : {
+ xtype : 'MemoryProxy',
+ data : [],
+ xns : Roo.data,
+ '|xns' : 'Roo.data'
+ },
+ reader : {
+ xtype : 'ArrayReader',
+ fields : [
+ {name: 'company'},
+ {name: 'price', type: 'float'},
+ {name: 'change', type: 'float'},
+ {name: 'pctChange', type: 'float'},
+ {name: 'lastChange', type: 'date', dateFormat: 'n/j h:ia'}
+ ],
+ xns : Roo.data,
+ '|xns' : 'Roo.data'
+ }
+ },
+ cm : [
+ {
+ xtype : 'ColumnModel',
+ dataIndex : 'company',
+ header : _this._strings['1c76cbfe21c6f44c1d1e59d54f3e4420'] /* Company */,
+ locked : false,
+ sortable : true,
+ width : 160,
+ xns : Roo.grid,
+ '|xns' : 'Roo.grid'
+ },
+ {
+ xtype : 'ColumnModel',
+ dataIndex : 'price',
+ header : _this._strings['3601146c4e948c32b6424d2c0a7f0118'] /* Price */,
+ locked : false,
+ renderer : Roo.util.Format.usMoney,
+ sortable : true,
+ width : 75,
+ xns : Roo.grid,
+ '|xns' : 'Roo.grid'
+ },
+ {
+ xtype : 'ColumnModel',
+ dataIndex : 'change',
+ header : _this._strings['f4ec5f57bd4d31b803312d873be40da9'] /* Change */,
+ locked : false,
+ renderer : function (val){
+ if(val > 0){
+ return '<span style="color:green;">' + val + '</span>';
+ }else if(val < 0){
+ return '<span style="color:red;">' + val + '</span>';
+ }
+ return val;
+ },
+ sortable : true,
+ width : 75,
+ xns : Roo.grid,
+ '|xns' : 'Roo.grid'
+ },
+ {
+ xtype : 'ColumnModel',
+ dataIndex : 'pctChange',
+ header : _this._strings['30870648ed968ed5a3e00631e4ad0699'] /* % Change */,
+ locked : false,
+ renderer : function (val){
+ if(val > 0){
+ return '<span style="color:green;">' + val + '%</span>';
+ }else if(val < 0){
+ return '<span style="color:red;">' + val + '%</span>';
+ }
+ return val;
+ },
+ sortable : true,
+ width : 75,
+ xns : Roo.grid,
+ '|xns' : 'Roo.grid'
+ },
+ {
+ xtype : 'ColumnModel',
+ dataIndex : 'lastChange',
+ header : _this._strings['4221d3e17c6eca2ca6337251a3cf9c4e'] /* Last Updated */,
+ locked : false,
+ renderer : Roo.util.Format.dateRenderer('m/d/Y'),
+ sortable : true,
+ width : 85,
+ xns : Roo.grid,
+ '|xns' : 'Roo.grid'
+ }
+ ]
+ }
+ }; }
+});
-<html>\r
-<head>\r
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">\r
-<title>Array Grid Example</title>\r
-\r
- <link rel="stylesheet" type="text/css" href="../../cssX/roojs-all.css"/>
- <link rel="stylesheet" type="text/css" href="../../cssX/xtheme-slate.css"/>
-
- <script type="text/javascript" src="../../roojs-all.js"></script>
- \r
- <script type="text/javascript" src="array-grid.js"></script>\r
- <link rel="stylesheet" type="text/css" href="grid-examples.css" />\r
-\r
- <!-- Common Styles for the examples -->\r
- <link rel="stylesheet" type="text/css" href="../examples.css" />\r
-</head>\r
-<body>\r
-<script type="text/javascript" src="../examples.js"></script><!-- EXAMPLES -->\r
-<h1>Array Grid Example</h1>\r
-<p>This example shows how to create a grid from Array data.</p>\r
-<p>Note that the js is not minified so it is readable. See
-<button type="button" onclick="RooDocs.viewSource.show('/array-grid.js')">array-grid.js</button> and
-<button type="button" onclick="RooDocs.viewSource.show('/array-grid.html')">array-grid.html</button> .</p>\r
-\r
-<div id="grid-panel" style="width:600px;height:300px;">\r
-<div id="grid-example"></div>\r
-</div>\r
-</body>\r
-</html>\r
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<title>Array Grid Example</title>
+ <link rel="stylesheet" type="text/css" href="../../cssX/roojs-all.css"/>
+
+ <script type="text/javascript" src="../../roojs-debug.js"></script>
+
+ <script type="text/javascript" src="../examples.js"></script>
+
+ <script type="text/javascript" src="ArrayGrid.js"></script>
+
+
+ <!-- Common Styles for the examples -->
+ <link rel="stylesheet" type="text/css" href="../examples.css" />
+
+
+
+
+</head>
+<body>
+<!-- EXAMPLES -->
+<h1>Array Panel Example</h1>
+
+<p>This example demostrates how to use a Roo.data.Store with a Roo.data.MemoryProxy and a Roo.data.ArrayReader along with loading the data from a javascript call
+The grid is set up in <button type="button" onclick="RooDocs.viewSource.show('/ArrayGrid.js')">ArrayGrid.js</button> which was generated using the roobuilder tool, and
+the data is loading on the buildcomplete event in <button type="button" onclick="RooDocs.viewSource.show('/array-grid.html')">array-grid.html</button> .</p>
+
+
+</p>
+ and
+
+<div id="grid-panel" style="width:600px;height:300px;">
+
+</div>
+
+
+</body>
+<script type="text/javascript">
+ Roo.onReady(function() {
+ Roo.XComponent.build();
+
+ Roo.XComponent.on('buildcomplete', function() {
+ ArrayGrid.grid.ds.load({
+ params : {
+ data : [
+ ['3m Co',71.72,0.02,0.03,'9/1 12:00am'],
+ ['Alcoa Inc',29.01,0.42,1.47,'9/1 12:00am'],
+ ['Altria Group Inc',83.81,0.28,0.34,'9/1 12:00am'],
+ ['American Express Company',52.55,0.01,0.02,'9/1 12:00am'],
+ ['American International Group, Inc.',64.13,0.31,0.49,'9/1 12:00am'],
+ ['AT&T Inc.',31.61,-0.48,-1.54,'9/1 12:00am'],
+ ['Boeing Co.',75.43,0.53,0.71,'9/1 12:00am'],
+ ['Caterpillar Inc.',67.27,0.92,1.39,'9/1 12:00am'],
+ ['Citigroup, Inc.',49.37,0.02,0.04,'9/1 12:00am'],
+ ['E.I. du Pont de Nemours and Company',40.48,0.51,1.28,'9/1 12:00am'],
+ ['Exxon Mobil Corp',68.1,-0.43,-0.64,'9/1 12:00am'],
+ ['General Electric Company',34.14,-0.08,-0.23,'9/1 12:00am'],
+ ['General Motors Corporation',30.27,1.09,3.74,'9/1 12:00am'],
+ ['Hewlett-Packard Co.',36.53,-0.03,-0.08,'9/1 12:00am'],
+ ['Honeywell Intl Inc',38.77,0.05,0.13,'9/1 12:00am'],
+ ['Intel Corporation',19.88,0.31,1.58,'9/1 12:00am'],
+ ['International Business Machines',81.41,0.44,0.54,'9/1 12:00am'],
+ ['Johnson & Johnson',64.72,0.06,0.09,'9/1 12:00am'],
+ ['JP Morgan & Chase & Co',45.73,0.07,0.15,'9/1 12:00am'],
+ ['McDonald\'s Corporation',36.76,0.86,2.40,'9/1 12:00am'],
+ ['Merck & Co., Inc.',40.96,0.41,1.01,'9/1 12:00am'],
+ ['Microsoft Corporation',25.84,0.14,0.54,'9/1 12:00am'],
+ ['Pfizer Inc',27.96,0.4,1.45,'9/1 12:00am'],
+ ['The Coca-Cola Company',45.07,0.26,0.58,'9/1 12:00am'],
+ ['The Home Depot, Inc.',34.64,0.35,1.02,'9/1 12:00am'],
+ ['The Procter & Gamble Company',61.91,0.01,0.02,'9/1 12:00am'],
+ ['United Technologies Corporation',63.26,0.55,0.88,'9/1 12:00am'],
+ ['Verizon Communications',35.57,0.39,1.11,'9/1 12:00am'],
+ ['Wal-Mart Stores, Inc.',45.45,0.73,1.63,'9/1 12:00am'],
+ ['Walt Disney Company (The) (Holding Company)',29.89,0.24,0.81,'9/1 12:00am']
+ ]
+ }
+ });
+
+
+
+ });
+
+ });
+</script>
+</html>
*
* Fork - LGPL
* <script type="text/javascript">
- */\r
+ */
Roo.BLANK_IMAGE_URL = "../../images/default/s.gif";
- \r
-var Example = {\r
- init : function(){\r
- // some data yanked off the web\r
- var myData = [\r
- ['3m Co',71.72,0.02,0.03,'9/1 12:00am'],\r
- ['Alcoa Inc',29.01,0.42,1.47,'9/1 12:00am'],\r
- ['Altria Group Inc',83.81,0.28,0.34,'9/1 12:00am'],\r
- ['American Express Company',52.55,0.01,0.02,'9/1 12:00am'],\r
- ['American International Group, Inc.',64.13,0.31,0.49,'9/1 12:00am'],\r
- ['AT&T Inc.',31.61,-0.48,-1.54,'9/1 12:00am'],\r
- ['Boeing Co.',75.43,0.53,0.71,'9/1 12:00am'],\r
- ['Caterpillar Inc.',67.27,0.92,1.39,'9/1 12:00am'],\r
- ['Citigroup, Inc.',49.37,0.02,0.04,'9/1 12:00am'],\r
- ['E.I. du Pont de Nemours and Company',40.48,0.51,1.28,'9/1 12:00am'],\r
- ['Exxon Mobil Corp',68.1,-0.43,-0.64,'9/1 12:00am'],\r
- ['General Electric Company',34.14,-0.08,-0.23,'9/1 12:00am'],\r
- ['General Motors Corporation',30.27,1.09,3.74,'9/1 12:00am'],\r
- ['Hewlett-Packard Co.',36.53,-0.03,-0.08,'9/1 12:00am'],\r
- ['Honeywell Intl Inc',38.77,0.05,0.13,'9/1 12:00am'],\r
- ['Intel Corporation',19.88,0.31,1.58,'9/1 12:00am'],\r
- ['International Business Machines',81.41,0.44,0.54,'9/1 12:00am'],\r
- ['Johnson & Johnson',64.72,0.06,0.09,'9/1 12:00am'],\r
- ['JP Morgan & Chase & Co',45.73,0.07,0.15,'9/1 12:00am'],\r
- ['McDonald\'s Corporation',36.76,0.86,2.40,'9/1 12:00am'],\r
- ['Merck & Co., Inc.',40.96,0.41,1.01,'9/1 12:00am'],\r
- ['Microsoft Corporation',25.84,0.14,0.54,'9/1 12:00am'],\r
- ['Pfizer Inc',27.96,0.4,1.45,'9/1 12:00am'],\r
- ['The Coca-Cola Company',45.07,0.26,0.58,'9/1 12:00am'],\r
- ['The Home Depot, Inc.',34.64,0.35,1.02,'9/1 12:00am'],\r
- ['The Procter & Gamble Company',61.91,0.01,0.02,'9/1 12:00am'],\r
- ['United Technologies Corporation',63.26,0.55,0.88,'9/1 12:00am'],\r
- ['Verizon Communications',35.57,0.39,1.11,'9/1 12:00am'],\r
- ['Wal-Mart Stores, Inc.',45.45,0.73,1.63,'9/1 12:00am'],\r
- ['Walt Disney Company (The) (Holding Company)',29.89,0.24,0.81,'9/1 12:00am']\r
- ];\r
-\r
- var ds = new Roo.data.Store({\r
- proxy: new Roo.data.MemoryProxy(myData),\r
- reader: new Roo.data.ArrayReader({}, [\r
- {name: 'company'},\r
- {name: 'price', type: 'float'},\r
- {name: 'change', type: 'float'},\r
- {name: 'pctChange', type: 'float'},\r
- {name: 'lastChange', type: 'date', dateFormat: 'n/j h:ia'}\r
- ])\r
- });\r
- ds.load();\r
-\r
- // example of custom renderer function\r
- function italic(value){\r
- return '<i>' + value + '</i>';\r
- }\r
-\r
- // example of custom renderer function\r
- function change(val){\r
- if(val > 0){\r
- return '<span style="color:green;">' + val + '</span>';\r
- }else if(val < 0){\r
- return '<span style="color:red;">' + val + '</span>';\r
- }\r
- return val;\r
- }\r
- // example of custom renderer function\r
- function pctChange(val){\r
- if(val > 0){\r
- return '<span style="color:green;">' + val + '%</span>';\r
- }else if(val < 0){\r
- return '<span style="color:red;">' + val + '%</span>';\r
- }\r
- return val;\r
- }\r
-\r
- // the DefaultColumnModel expects this blob to define columns. It can be extended to provide\r
- // custom or reusable ColumnModels\r
- var colModel = new Roo.grid.ColumnModel([\r
- {id:'company',header: "Company", width: 160, sortable: true, locked:false, dataIndex: 'company'},\r
- {header: "Price", width: 75, sortable: true, renderer: Roo.util.Format.usMoney, dataIndex: 'price'},\r
- {header: "Change", width: 75, sortable: true, renderer: change, dataIndex: 'change'},\r
- {header: "% Change", width: 75, sortable: true, renderer: pctChange, dataIndex: 'pctChange'},\r
- {header: "Last Updated", width: 85, sortable: true, renderer: Roo.util.Format.dateRenderer('m/d/Y'), dataIndex: 'lastChange'}\r
- ]);\r
-\r
-\r
- // create the Grid\r
- var grid = new Roo.grid.Grid('grid-example', {\r
- ds: ds,\r
- cm: colModel,\r
- autoExpandColumn: 'company'\r
- });\r
- \r
- var layout = Roo.BorderLayout.create({\r
- center: {\r
- margins:{left:3,top:3,right:3,bottom:3},\r
- panels: [new Roo.GridPanel(grid)]\r
- }\r
- }, 'grid-panel');\r
-\r
- grid.render();\r
- \r
-\r
- grid.getSelectionModel().selectFirstRow();\r
- }\r
-};\r
+
+var Example = {
+ init : function(){
+ // some data yanked off the web
+ var myData = [
+ ['3m Co',71.72,0.02,0.03,'9/1 12:00am'],
+ ['Alcoa Inc',29.01,0.42,1.47,'9/1 12:00am'],
+ ['Altria Group Inc',83.81,0.28,0.34,'9/1 12:00am'],
+ ['American Express Company',52.55,0.01,0.02,'9/1 12:00am'],
+ ['American International Group, Inc.',64.13,0.31,0.49,'9/1 12:00am'],
+ ['AT&T Inc.',31.61,-0.48,-1.54,'9/1 12:00am'],
+ ['Boeing Co.',75.43,0.53,0.71,'9/1 12:00am'],
+ ['Caterpillar Inc.',67.27,0.92,1.39,'9/1 12:00am'],
+ ['Citigroup, Inc.',49.37,0.02,0.04,'9/1 12:00am'],
+ ['E.I. du Pont de Nemours and Company',40.48,0.51,1.28,'9/1 12:00am'],
+ ['Exxon Mobil Corp',68.1,-0.43,-0.64,'9/1 12:00am'],
+ ['General Electric Company',34.14,-0.08,-0.23,'9/1 12:00am'],
+ ['General Motors Corporation',30.27,1.09,3.74,'9/1 12:00am'],
+ ['Hewlett-Packard Co.',36.53,-0.03,-0.08,'9/1 12:00am'],
+ ['Honeywell Intl Inc',38.77,0.05,0.13,'9/1 12:00am'],
+ ['Intel Corporation',19.88,0.31,1.58,'9/1 12:00am'],
+ ['International Business Machines',81.41,0.44,0.54,'9/1 12:00am'],
+ ['Johnson & Johnson',64.72,0.06,0.09,'9/1 12:00am'],
+ ['JP Morgan & Chase & Co',45.73,0.07,0.15,'9/1 12:00am'],
+ ['McDonald\'s Corporation',36.76,0.86,2.40,'9/1 12:00am'],
+ ['Merck & Co., Inc.',40.96,0.41,1.01,'9/1 12:00am'],
+ ['Microsoft Corporation',25.84,0.14,0.54,'9/1 12:00am'],
+ ['Pfizer Inc',27.96,0.4,1.45,'9/1 12:00am'],
+ ['The Coca-Cola Company',45.07,0.26,0.58,'9/1 12:00am'],
+ ['The Home Depot, Inc.',34.64,0.35,1.02,'9/1 12:00am'],
+ ['The Procter & Gamble Company',61.91,0.01,0.02,'9/1 12:00am'],
+ ['United Technologies Corporation',63.26,0.55,0.88,'9/1 12:00am'],
+ ['Verizon Communications',35.57,0.39,1.11,'9/1 12:00am'],
+ ['Wal-Mart Stores, Inc.',45.45,0.73,1.63,'9/1 12:00am'],
+ ['Walt Disney Company (The) (Holding Company)',29.89,0.24,0.81,'9/1 12:00am']
+ ];
+
+ var ds = new Roo.data.Store({
+ proxy: new Roo.data.MemoryProxy(myData),
+ reader: new Roo.data.ArrayReader({}, [
+ {name: 'company'},
+ {name: 'price', type: 'float'},
+ {name: 'change', type: 'float'},
+ {name: 'pctChange', type: 'float'},
+ {name: 'lastChange', type: 'date', dateFormat: 'n/j h:ia'}
+ ])
+ });
+ ds.load();
+
+ // example of custom renderer function
+ function italic(value){
+ return '<i>' + value + '</i>';
+ }
+
+ // example of custom renderer function
+ function change(val){
+ if(val > 0){
+ return '<span style="color:green;">' + val + '</span>';
+ }else if(val < 0){
+ return '<span style="color:red;">' + val + '</span>';
+ }
+ return val;
+ }
+ // example of custom renderer function
+ function pctChange(val){
+ if(val > 0){
+ return '<span style="color:green;">' + val + '%</span>';
+ }else if(val < 0){
+ return '<span style="color:red;">' + val + '%</span>';
+ }
+ return val;
+ }
+
+ // the DefaultColumnModel expects this blob to define columns. It can be extended to provide
+ // custom or reusable ColumnModels
+ var colModel = new Roo.grid.ColumnModel([
+ {id:'company',header: "Company", width: 160, sortable: true, locked:false, dataIndex: 'company'},
+ {header: "Price", width: 75, sortable: true, renderer: Roo.util.Format.usMoney, dataIndex: 'price'},
+ {header: "Change", width: 75, sortable: true, renderer: change, dataIndex: 'change'},
+ {header: "% Change", width: 75, sortable: true, renderer: pctChange, dataIndex: 'pctChange'},
+ {header: "Last Updated", width: 85, sortable: true, renderer: Roo.util.Format.dateRenderer('m/d/Y'), dataIndex: 'lastChange'}
+ ]);
+
+
+ // create the Grid
+ var grid = new Roo.grid.Grid('grid-example', {
+ ds: ds,
+ cm: colModel,
+ autoExpandColumn: 'company'
+ });
+
+ var layout = Roo.BorderLayout.create({
+ center: {
+ margins:{left:3,top:3,right:3,bottom:3},
+ panels: [new Roo.GridPanel(grid)]
+ }
+ }, 'grid-panel');
+
+ grid.render();
+
+
+ grid.getSelectionModel().selectFirstRow();
+ }
+};
Roo.onReady(Example.init, Example);
\ No newline at end of file
// Roo/data/DataProxy.js
Roo.data.DataProxy=function(){this.addEvents({beforeload:true,load:true,loadexception:true});Roo.data.DataProxy.superclass.constructor.call(this);};Roo.extend(Roo.data.DataProxy,Roo.util.Observable);
// Roo/data/MemoryProxy.js
-Roo.data.MemoryProxy=function(A){if(A.data){A=A.data;}Roo.data.MemoryProxy.superclass.constructor.call(this);this.data=A;};Roo.extend(Roo.data.MemoryProxy,Roo.data.DataProxy,{load:function(A,B,C,D,E){A=A||{};var F;try{F=B.readRecords(A.data?A.data:this.data);
-}catch(e){this.fireEvent("loadexception",this,E,null,e);C.call(D,null,E,false);return;}C.call(D,F,E,true);},update:function(A,B){}});
+Roo.data.MemoryProxy=function(A){if(typeof(A)!='undefined'&&typeof(A.data)!='undefined'){A=A.data;}Roo.data.MemoryProxy.superclass.constructor.call(this);this.data=A;};Roo.extend(Roo.data.MemoryProxy,Roo.data.DataProxy,{load:function(A,B,C,D,E){A=A||{};var F;
+try{F=B.readRecords(A.data?A.data:this.data);}catch(e){this.fireEvent("loadexception",this,E,null,e);C.call(D,null,E,false);return;}C.call(D,F,E,true);},update:function(A,B){}});
// Roo/data/HttpProxy.js
Roo.data.HttpProxy=function(A){Roo.data.HttpProxy.superclass.constructor.call(this);this.conn=A;this.useAjax=!A||!A.events;};Roo.extend(Roo.data.HttpProxy,Roo.data.DataProxy,{getConnection:function(){return this.useAjax?Roo.Ajax:this.conn;},load:function(A,B,C,D,E){if(this.fireEvent("beforeload",this,A)!==false){var o={params:A||{}
,request:{callback:C,scope:D,arg:E},reader:B,callback:this.loadResponse,scope:this};if(this.useAjax){Roo.applyIf(o,this.conn);if(this.activeRequest){Roo.Ajax.abort(this.activeRequest);}this.activeRequest=Roo.Ajax.request(o);}else{this.conn.request(o);}}else{C.call(D||this,null,E,false);
*/
/**
* @class Roo.data.MemoryProxy
+ * @extends Roo.data.DataProxy
* An implementation of Roo.data.DataProxy that simply passes the data specified in its constructor
* to the Reader when its load method is called.
* @constructor
- * @param {Object} data The data object which the Reader uses to construct a block of Roo.data.Records.
+ * @param {Object} config A config object containing the objects needed for the Store to access data,
*/
Roo.data.MemoryProxy = function(data){
- if (data.data) {
+ if (typeof(data) != 'undefined' && typeof(data.data) != 'undefined') {
data = data.data;
}
Roo.data.MemoryProxy.superclass.constructor.call(this);
Roo.extend(Roo.data.MemoryProxy, Roo.data.DataProxy, {
+ /**
+ * @cfg {Object} data The data object which the Reader uses to construct a block of Roo.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
// Roo/data/DataProxy.js
Roo.data.DataProxy=function(){this.addEvents({beforeload:true,load:true,loadexception:true});Roo.data.DataProxy.superclass.constructor.call(this);};Roo.extend(Roo.data.DataProxy,Roo.util.Observable);
// Roo/data/MemoryProxy.js
-Roo.data.MemoryProxy=function(A){if(A.data){A=A.data;}Roo.data.MemoryProxy.superclass.constructor.call(this);this.data=A;};Roo.extend(Roo.data.MemoryProxy,Roo.data.DataProxy,{load:function(A,B,C,D,E){A=A||{};var F;try{F=B.readRecords(A.data?A.data:this.data);
-}catch(e){this.fireEvent("loadexception",this,E,null,e);C.call(D,null,E,false);return;}C.call(D,F,E,true);},update:function(A,B){}});
+Roo.data.MemoryProxy=function(A){if(typeof(A)!='undefined'&&typeof(A.data)!='undefined'){A=A.data;}Roo.data.MemoryProxy.superclass.constructor.call(this);this.data=A;};Roo.extend(Roo.data.MemoryProxy,Roo.data.DataProxy,{load:function(A,B,C,D,E){A=A||{};var F;
+try{F=B.readRecords(A.data?A.data:this.data);}catch(e){this.fireEvent("loadexception",this,E,null,e);C.call(D,null,E,false);return;}C.call(D,F,E,true);},update:function(A,B){}});
// Roo/data/HttpProxy.js
Roo.data.HttpProxy=function(A){Roo.data.HttpProxy.superclass.constructor.call(this);this.conn=A;this.useAjax=!A||!A.events;};Roo.extend(Roo.data.HttpProxy,Roo.data.DataProxy,{getConnection:function(){return this.useAjax?Roo.Ajax:this.conn;},load:function(A,B,C,D,E){if(this.fireEvent("beforeload",this,A)!==false){var o={params:A||{}
,request:{callback:C,scope:D,arg:E},reader:B,callback:this.loadResponse,scope:this};if(this.useAjax){Roo.applyIf(o,this.conn);if(this.activeRequest){Roo.Ajax.abort(this.activeRequest);}this.activeRequest=Roo.Ajax.request(o);}else{this.conn.request(o);}}else{C.call(D||this,null,E,false);
*/
/**
* @class Roo.data.MemoryProxy
+ * @extends Roo.data.DataProxy
* An implementation of Roo.data.DataProxy that simply passes the data specified in its constructor
* to the Reader when its load method is called.
* @constructor
- * @param {Object} data The data object which the Reader uses to construct a block of Roo.data.Records.
+ * @param {Object} config A config object containing the objects needed for the Store to access data,
*/
Roo.data.MemoryProxy = function(data){
- if (data.data) {
+ if (typeof(data) != 'undefined' && typeof(data.data) != 'undefined') {
data = data.data;
}
Roo.data.MemoryProxy.superclass.constructor.call(this);
Roo.extend(Roo.data.MemoryProxy, Roo.data.DataProxy, {
+ /**
+ * @cfg {Object} data The data object which the Reader uses to construct a block of Roo.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
*/
/**
* @class Roo.data.MemoryProxy
+ * @extends Roo.data.DataProxy
* An implementation of Roo.data.DataProxy that simply passes the data specified in its constructor
* to the Reader when its load method is called.
* @constructor
- * @param {Object} data The data object which the Reader uses to construct a block of Roo.data.Records.
+ * @param {Object} config A config object containing the objects needed for the Store to access data,
*/
Roo.data.MemoryProxy = function(data){
- if (data.data) {
+ if (typeof(data) != 'undefined' && typeof(data.data) != 'undefined') {
data = data.data;
}
Roo.data.MemoryProxy.superclass.constructor.call(this);
Roo.extend(Roo.data.MemoryProxy, Roo.data.DataProxy, {
+ /**
+ * @cfg {Object} data The data object which the Reader uses to construct a block of Roo.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
// Roo/data/DataProxy.js
Roo.data.DataProxy=function(){this.addEvents({beforeload:true,load:true,loadexception:true});Roo.data.DataProxy.superclass.constructor.call(this);};Roo.extend(Roo.data.DataProxy,Roo.util.Observable);
// Roo/data/MemoryProxy.js
-Roo.data.MemoryProxy=function(A){if(A.data){A=A.data;}Roo.data.MemoryProxy.superclass.constructor.call(this);this.data=A;};Roo.extend(Roo.data.MemoryProxy,Roo.data.DataProxy,{load:function(A,B,C,D,E){A=A||{};var F;try{F=B.readRecords(A.data?A.data:this.data);
-}catch(e){this.fireEvent("loadexception",this,E,null,e);C.call(D,null,E,false);return;}C.call(D,F,E,true);},update:function(A,B){}});
+Roo.data.MemoryProxy=function(A){if(typeof(A)!='undefined'&&typeof(A.data)!='undefined'){A=A.data;}Roo.data.MemoryProxy.superclass.constructor.call(this);this.data=A;};Roo.extend(Roo.data.MemoryProxy,Roo.data.DataProxy,{load:function(A,B,C,D,E){A=A||{};var F;
+try{F=B.readRecords(A.data?A.data:this.data);}catch(e){this.fireEvent("loadexception",this,E,null,e);C.call(D,null,E,false);return;}C.call(D,F,E,true);},update:function(A,B){}});
// Roo/data/HttpProxy.js
Roo.data.HttpProxy=function(A){Roo.data.HttpProxy.superclass.constructor.call(this);this.conn=A;this.useAjax=!A||!A.events;};Roo.extend(Roo.data.HttpProxy,Roo.data.DataProxy,{getConnection:function(){return this.useAjax?Roo.Ajax:this.conn;},load:function(A,B,C,D,E){if(this.fireEvent("beforeload",this,A)!==false){var o={params:A||{}
,request:{callback:C,scope:D,arg:E},reader:B,callback:this.loadResponse,scope:this};if(this.useAjax){Roo.applyIf(o,this.conn);if(this.activeRequest){Roo.Ajax.abort(this.activeRequest);}this.activeRequest=Roo.Ajax.request(o);}else{this.conn.request(o);}}else{C.call(D||this,null,E,false);