From 3ceb008849553fc9d0235f889c190a73330ea822 Mon Sep 17 00:00:00 2001 From: Alan Date: Tue, 19 Apr 2022 15:59:30 +0800 Subject: [PATCH] Fix #7189 - simplify array grid example --- Roo/data/MemoryProxy.js | 8 +- docs/json/roodata.json | 465 +++++++++++++++++++++++- docs/src/Roo_data_MemoryProxy.js.html | 8 +- docs/symbols/Roo.data.DataProxy.json | 3 +- docs/symbols/Roo.data.MemoryProxy.json | 470 ++++++++++++++++++++++++- docs/symbols/Roo.util.Observable.json | 3 +- examples/grid/ArrayGrid.bjs | 107 ++++++ examples/grid/ArrayGrid.js | 136 +++++++ examples/grid/array-grid.html | 117 ++++-- examples/grid/array-grid.js | 210 +++++------ roojs-all.js | 4 +- roojs-bootstrap-debug.js | 8 +- roojs-bootstrap.js | 4 +- roojs-debug.js | 8 +- roojs-ui-debug.js | 8 +- roojs-ui.js | 4 +- 16 files changed, 1403 insertions(+), 160 deletions(-) create mode 100644 examples/grid/ArrayGrid.bjs create mode 100644 examples/grid/ArrayGrid.js diff --git a/Roo/data/MemoryProxy.js b/Roo/data/MemoryProxy.js index ac626fb9d4..457fc58e84 100644 --- a/Roo/data/MemoryProxy.js +++ b/Roo/data/MemoryProxy.js @@ -10,13 +10,14 @@ */ /** * @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); @@ -25,6 +26,9 @@ Roo.data.MemoryProxy = function(data){ 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 diff --git a/docs/json/roodata.json b/docs/json/roodata.json index 49146ce23e..2b6f3f40b2 100644 --- a/docs/json/roodata.json +++ b/docs/json/roodata.json @@ -189321,7 +189321,8 @@ "isAbstract" : true, "isBuilderTop" : false, "implementations" : [ - "Roo.data.HttpProxy" + "Roo.data.HttpProxy", + "Roo.data.MemoryProxy" ], "tree_children" : [], "tree_parent" : [] @@ -191708,9 +191709,301 @@ "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
\n    listeners :  { \n       'click' : function(e) {\n           ..... \n        } ,\n        .... \n    } \n  
", + "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:
\n

\nCombining Options
\nUsing the options argument, it is possible to combine different types of listeners:
\n
\nA normalized, delayed, one-time listener that auto stops the event and passes a custom argument (forumId)\n\t\t

\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
\n

\nAttaching multiple handlers in 1 call
\nThe method also allows for a single argument to be passed which is a config object containing properties\nwhich specify multiple handlers.\n

\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
\n

\nOr a shorthand syntax which passes the same scope object to all handlers:\n \t

\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
", + "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\nbefore 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", @@ -191760,6 +192053,171 @@ } ], "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 all 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, @@ -316755,6 +317213,7 @@ "Roo.data.DataProxy", "Roo.data.HttpProxy", "Roo.data.JsonStore", + "Roo.data.MemoryProxy", "Roo.data.Node", "Roo.data.SimpleStore", "Roo.data.Store", diff --git a/docs/src/Roo_data_MemoryProxy.js.html b/docs/src/Roo_data_MemoryProxy.js.html index c3da147a83..14d027152c 100644 --- a/docs/src/Roo_data_MemoryProxy.js.html +++ b/docs/src/Roo_data_MemoryProxy.js.html @@ -10,13 +10,14 @@ */ /** * @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); @@ -26,6 +27,9 @@ 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 * a block of Roo.data.Records using the passed Roo.data.DataReader implementation, and diff --git a/docs/symbols/Roo.data.DataProxy.json b/docs/symbols/Roo.data.DataProxy.json index 002b6040a6..88a04d3a6f 100644 --- a/docs/symbols/Roo.data.DataProxy.json +++ b/docs/symbols/Roo.data.DataProxy.json @@ -5,7 +5,8 @@ ], "childClasses" : { "Roo.data.DataProxy" : [ - "Roo.data.HttpProxy" + "Roo.data.HttpProxy", + "Roo.data.MemoryProxy" ] }, "tree_children" : [], diff --git a/docs/symbols/Roo.data.MemoryProxy.json b/docs/symbols/Roo.data.MemoryProxy.json index 52686be67f..999fdf5e0c 100644 --- a/docs/symbols/Roo.data.MemoryProxy.json +++ b/docs/symbols/Roo.data.MemoryProxy.json @@ -1,6 +1,9 @@ { "name" : "Roo.data.MemoryProxy", - "augments" : [], + "augments" : [ + "Roo.data.DataProxy", + "Roo.util.Observable" + ], "childClasses" : { }, "tree_children" : [], "tree_parent" : [], @@ -17,16 +20,33 @@ "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
\n    listeners :  { \n       'click' : function(e) {\n           ..... \n        } ,\n        .... \n    } \n  
", + "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", @@ -77,7 +97,447 @@ } ], "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 all 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\nbefore 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:
\n

\nCombining Options
\nUsing the options argument, it is possible to combine different types of listeners:
\n
\nA normalized, delayed, one-time listener that auto stops the event and passes a custom argument (forumId)\n\t\t

\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
\n

\nAttaching multiple handlers in 1 call
\nThe method also allows for a single argument to be passed which is a config object containing properties\nwhich specify multiple handlers.\n

\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
\n

\nOr a shorthand syntax which passes the same scope object to all handlers:\n \t

\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
", + "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 diff --git a/docs/symbols/Roo.util.Observable.json b/docs/symbols/Roo.util.Observable.json index 5b1166440a..8b0f673dcc 100644 --- a/docs/symbols/Roo.util.Observable.json +++ b/docs/symbols/Roo.util.Observable.json @@ -51,7 +51,8 @@ "Roo.JsonView" ], "Roo.data.DataProxy" : [ - "Roo.data.HttpProxy" + "Roo.data.HttpProxy", + "Roo.data.MemoryProxy" ], "Roo.menu.Menu" : [ "Roo.menu.ColorMenu", diff --git a/examples/grid/ArrayGrid.bjs b/examples/grid/ArrayGrid.bjs new file mode 100644 index 0000000000..0c18073388 --- /dev/null +++ b/examples/grid/ArrayGrid.bjs @@ -0,0 +1,107 @@ +{ + "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 '' + val + '';\n }else if(val < 0){\n return '' + val + '';\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 '' + val + '%';\n }else if(val < 0){\n return '' + val + '%';\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 diff --git a/examples/grid/ArrayGrid.js b/examples/grid/ArrayGrid.js new file mode 100644 index 0000000000..80d04e5276 --- /dev/null +++ b/examples/grid/ArrayGrid.js @@ -0,0 +1,136 @@ +// - - - - - - - - - -

Array Grid Example

-

This example shows how to create a grid from Array data.

-

Note that the js is not minified so it is readable. See - and - .

- -
-
-
- - + + + + +Array Grid Example + + + + + + + + + + + + + + + + + + +

Array Panel Example

+ +

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 which was generated using the roobuilder tool, and +the data is loading on the buildcomplete event in .

+ + +

+ and + +
+ +
+ + + + + diff --git a/examples/grid/array-grid.js b/examples/grid/array-grid.js index fdfc59e53f..dc9a372731 100644 --- a/examples/grid/array-grid.js +++ b/examples/grid/array-grid.js @@ -7,112 +7,112 @@ * * Fork - LGPL *