* nodes from a specified URL. The response must be a javascript Array definition
* who's elements are node definition objects. eg:
* <pre><code>
- [{ 'id': 1, 'text': 'A folder Node', 'leaf': false },
- { 'id': 2, 'text': 'A leaf Node', 'leaf': true }]
+{ success : true,
+ data : [
+
+ { 'id': 1, 'text': 'A folder Node', 'leaf': false },
+ { 'id': 2, 'text': 'A leaf Node', 'leaf': true }
+ ]
+}
+
+
</code></pre>
* <br><br>
+ * The old style respose with just an array is still supported, but not recommended.
+ * <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.
myTreeLoader.on("beforeload", function(treeLoader, node) {
this.baseParams.category = node.attributes.category;
}, this);
-</code></pre><
+
+</code></pre>
+ *
* This would pass an HTTP parameter called "category" to the server containing
* the value of the Node's "category" attribute.
* @constructor
* to be loaded.
*/
/**
+ * @cfg {String} requestMethod either GET or POST
+ * defaults to POST (due to BC)
+ * to be loaded.
+ */
+ /**
* @cfg {Object} baseParams (optional) An object containing properties which
* specify HTTP parameters to be passed to each request for child nodes.
*/
/**
* @cfg {Object} uiProviders (optional) An object containing properties which
*
- * DEPRECIATED - use 'create' event handler to modify attributes - which affect creation.
+ * DEPRECATED - use 'create' event handler to modify attributes - which affect creation.
* specify custom {@link Roo.tree.TreeNodeUI} implementations. If the optional
* <i>uiProvider</i> attribute of a returned child node is a string rather
* than a reference to a TreeNodeUI implementation, this that string value
var o = Roo.decode(json);
- if (!o.success) {
+ if (this.root === false && typeof(o.success) != undefined) {
+ this.root = 'data'; // the default behaviour for list like data..
+ }
+
+ if (this.root !== false && !o.success) {
// it's a failure condition.
var a = response.argument;
this.fireEvent("loadexception", this, a.node, response);
return;
}
+
+
if (this.root !== false) {
- o = o[this.root];
+ o = o[this.root];
}
for(var i = 0, len = o.length; i < len; i++){