7e872466baad9bb3a6b81da70300b1605a5f43b8
[roojs1] / docs / symbols / Roo.tree.TreeLoader.json
1 {
2   "name" : "Roo.tree.TreeLoader",
3   "augments" : [
4     "Roo.util.Observable"
5   ],
6   "childClasses" : {  },
7   "tree_children" : [],
8   "tree_parent" : [],
9   "desc" : "A TreeLoader provides for lazy loading of an {@link Roo.tree.TreeNode}'s child\nnodes from a specified URL. The response must be a javascript Array definition\nwho's elements are node definition objects. eg:\n<pre><code>\n{  success : true,\n   data :      [\n   \n    { 'id': 1, 'text': 'A folder Node', 'leaf': false },\n    { 'id': 2, 'text': 'A leaf Node', 'leaf': true }\n    ]\n}\n\n\n</code></pre>\n<br><br>\nThe old style respose with just an array is still supported, but not recommended.\n<br><br>\n\nA server request is sent, and child nodes are loaded only when a node is expanded.\nThe loading node's id is passed to the server under the parameter name \"node\" to\nenable the server to produce the correct child nodes.\n<br><br>\nTo pass extra parameters, an event handler may be attached to the \"beforeload\"\nevent, and the parameters specified in the TreeLoader's baseParams property:\n<pre><code>\n    myTreeLoader.on(\"beforeload\", function(treeLoader, node) {\n        this.baseParams.category = node.attributes.category;\n    }, this);\n    \n</code></pre>\n\nThis would pass an HTTP parameter called \"category\" to the server containing\nthe value of the Node's \"category\" attribute.",
10   "isSingleton" : false,
11   "isStatic" : false,
12   "isBuiltin" : false,
13   "isAbstract" : false,
14   "isBuilderTop" : false,
15   "memberOf" : "TreeLoader",
16   "example" : "",
17   "deprecated" : "",
18   "since" : "",
19   "see" : "",
20   "params" : [
21     {
22       "name" : "config",
23       "type" : "Object",
24       "desc" : "A config object containing config properties.",
25       "isOptional" : false
26     }
27   ],
28   "returns" : [],
29   "throws" : "",
30   "requires" : "",
31   "config" : [
32     {
33       "name" : "listeners",
34       "type" : "Object",
35       "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>",
36       "memberOf" : "Roo.util.Observable"
37     },
38     {
39       "name" : "clearOnLoad",
40       "type" : "Boolean",
41       "desc" : "(optional) Default to true. Remove previously existing\nchild nodes before loading.",
42       "memberOf" : "Roo.tree.TreeLoader"
43     },
44     {
45       "name" : "dataUrl",
46       "type" : "String",
47       "desc" : "The URL from which to request a Json string which\nspecifies an array of node definition object representing the child nodes\nto be loaded.",
48       "memberOf" : "Roo.tree.TreeLoader"
49     },
50     {
51       "name" : "root",
52       "type" : "String",
53       "desc" : "(optional) Default to false. Use this to read data from an object \nproperty on loading, rather than expecting an array. (eg. more compatible to a standard\nGrid query { data : [ .....] }",
54       "memberOf" : "Roo.tree.TreeLoader"
55     },
56     {
57       "name" : "requestMethod",
58       "type" : "String",
59       "desc" : "either GET or POST\ndefaults to POST (due to BC)\nto be loaded.",
60       "memberOf" : "Roo.tree.TreeLoader"
61     },
62     {
63       "name" : "baseParams",
64       "type" : "Object",
65       "desc" : "(optional) An object containing properties which\nspecify HTTP parameters to be passed to each request for child nodes.",
66       "memberOf" : "Roo.tree.TreeLoader"
67     },
68     {
69       "name" : "baseAttrs",
70       "type" : "Object",
71       "desc" : "(optional) An object containing attributes to be added to all nodes\ncreated by this loader. If the attributes sent by the server have an attribute in this object,\nthey take priority.",
72       "memberOf" : "Roo.tree.TreeLoader"
73     },
74     {
75       "name" : "uiProviders",
76       "type" : "Object",
77       "desc" : "(optional) An object containing properties which\n\nDEPRECATED - use 'create' event handler to modify attributes - which affect creation.\nspecify custom {@link Roo.tree.TreeNodeUI} implementations. If the optional\n<i>uiProvider</i> attribute of a returned child node is a string rather\nthan a reference to a TreeNodeUI implementation, this that string value\nis used as a property name in the uiProviders object. You can define the provider named\n'default' , and this will be used for all nodes (if no uiProvider is delivered by the node data)",
78       "memberOf" : "Roo.tree.TreeLoader"
79     },
80     {
81       "name" : "queryParam",
82       "type" : "String",
83       "desc" : "(optional) \nName of the query as it will be passed on the querystring (defaults to 'node')\neg. the request will be ?node=[id]",
84       "memberOf" : "Roo.tree.TreeLoader"
85     }
86   ],
87   "methods" : [
88     {
89       "name" : "load",
90       "type" : "function",
91       "desc" : "Load an {@link Roo.tree.TreeNode} from the URL specified in the constructor.\nThis is called automatically when a node is expanded, but may be used to reload\na node (or append new children if the {@link #clearOnLoad} option is false.)",
92       "sig" : "(node, callback)",
93       "static" : false,
94       "memberOf" : "",
95       "isStatic" : false,
96       "isConstructor" : false,
97       "isPrivate" : false,
98       "example" : "",
99       "deprecated" : "",
100       "since" : "",
101       "see" : "",
102       "exceptions" : "",
103       "requires" : "",
104       "params" : [
105         {
106           "name" : "node",
107           "type" : "Roo.tree.TreeNode",
108           "desc" : "",
109           "isOptional" : false
110         },
111         {
112           "name" : "callback",
113           "type" : "Function",
114           "desc" : "",
115           "isOptional" : false
116         }
117       ],
118       "returns" : []
119     },
120     {
121       "name" : "purgeListeners",
122       "type" : "function",
123       "desc" : "Removes all listeners for this object",
124       "sig" : "()\n{\n\n}",
125       "static" : false,
126       "memberOf" : "Roo.util.Observable",
127       "isStatic" : false,
128       "isConstructor" : false,
129       "isPrivate" : false,
130       "example" : "",
131       "deprecated" : "",
132       "since" : "",
133       "see" : "",
134       "exceptions" : "",
135       "requires" : "",
136       "params" : [],
137       "returns" : []
138     },
139     {
140       "name" : "on",
141       "type" : "function",
142       "desc" : "Appends an event handler to this element (shorthand for addListener)",
143       "sig" : "(eventName, handler, scope, options)",
144       "static" : false,
145       "memberOf" : "Roo.util.Observable",
146       "isStatic" : false,
147       "isConstructor" : false,
148       "isPrivate" : false,
149       "example" : "",
150       "deprecated" : "",
151       "since" : "",
152       "see" : "",
153       "exceptions" : "",
154       "requires" : "",
155       "params" : [
156         {
157           "name" : "eventName",
158           "type" : "String",
159           "desc" : "The type of event to listen for",
160           "isOptional" : false
161         },
162         {
163           "name" : "handler",
164           "type" : "Function",
165           "desc" : "The method the event invokes",
166           "isOptional" : false
167         },
168         {
169           "name" : "scope",
170           "type" : "Object",
171           "desc" : "(optional) The scope in which to execute the handler\nfunction. The handler function's \"this\" context.",
172           "isOptional" : false
173         },
174         {
175           "name" : "options",
176           "type" : "Object",
177           "desc" : "(optional)",
178           "isOptional" : false
179         }
180       ],
181       "returns" : []
182     },
183     {
184       "name" : "un",
185       "type" : "function",
186       "desc" : "Removes a listener (shorthand for removeListener)",
187       "sig" : "(eventName, handler, scope)",
188       "static" : false,
189       "memberOf" : "Roo.util.Observable",
190       "isStatic" : false,
191       "isConstructor" : false,
192       "isPrivate" : false,
193       "example" : "",
194       "deprecated" : "",
195       "since" : "",
196       "see" : "",
197       "exceptions" : "",
198       "requires" : "",
199       "params" : [
200         {
201           "name" : "eventName",
202           "type" : "String",
203           "desc" : "The type of event to listen for",
204           "isOptional" : false
205         },
206         {
207           "name" : "handler",
208           "type" : "Function",
209           "desc" : "The handler to remove",
210           "isOptional" : false
211         },
212         {
213           "name" : "scope",
214           "type" : "Object",
215           "desc" : "(optional) The scope (this object) for the handler",
216           "isOptional" : false
217         }
218       ],
219       "returns" : []
220     },
221     {
222       "name" : "addEvents",
223       "type" : "function",
224       "desc" : "Used to define events on this Observable",
225       "sig" : "(object)",
226       "static" : false,
227       "memberOf" : "Roo.util.Observable",
228       "isStatic" : false,
229       "isConstructor" : false,
230       "isPrivate" : false,
231       "example" : "",
232       "deprecated" : "",
233       "since" : "",
234       "see" : "",
235       "exceptions" : "",
236       "requires" : "",
237       "params" : [
238         {
239           "name" : "object",
240           "type" : "Object",
241           "desc" : "The object with the events defined",
242           "isOptional" : false
243         }
244       ],
245       "returns" : []
246     },
247     {
248       "name" : "releaseCapture",
249       "type" : "function",
250       "desc" : "Removes <b>all</b> added captures from the Observable.",
251       "sig" : "(o)",
252       "static" : true,
253       "memberOf" : "Roo.util.Observable",
254       "isStatic" : true,
255       "isConstructor" : false,
256       "isPrivate" : false,
257       "example" : "",
258       "deprecated" : "",
259       "since" : "",
260       "see" : "",
261       "exceptions" : "",
262       "requires" : "",
263       "params" : [
264         {
265           "name" : "o",
266           "type" : "Observable",
267           "desc" : "The Observable to release",
268           "isOptional" : false
269         }
270       ],
271       "returns" : []
272     },
273     {
274       "name" : "removeListener",
275       "type" : "function",
276       "desc" : "Removes a listener",
277       "sig" : "(eventName, handler, scope)",
278       "static" : false,
279       "memberOf" : "Roo.util.Observable",
280       "isStatic" : false,
281       "isConstructor" : false,
282       "isPrivate" : false,
283       "example" : "",
284       "deprecated" : "",
285       "since" : "",
286       "see" : "",
287       "exceptions" : "",
288       "requires" : "",
289       "params" : [
290         {
291           "name" : "eventName",
292           "type" : "String",
293           "desc" : "The type of event to listen for",
294           "isOptional" : false
295         },
296         {
297           "name" : "handler",
298           "type" : "Function",
299           "desc" : "The handler to remove",
300           "isOptional" : false
301         },
302         {
303           "name" : "scope",
304           "type" : "Object",
305           "desc" : "(optional) The scope (this object) for the handler",
306           "isOptional" : false
307         }
308       ],
309       "returns" : []
310     },
311     {
312       "name" : "fireEvent",
313       "type" : "function",
314       "desc" : "Fires the specified event with the passed parameters (minus the event name).",
315       "sig" : "(eventName, args)",
316       "static" : false,
317       "memberOf" : "Roo.util.Observable",
318       "isStatic" : false,
319       "isConstructor" : false,
320       "isPrivate" : false,
321       "example" : "",
322       "deprecated" : "",
323       "since" : "",
324       "see" : "",
325       "exceptions" : "",
326       "requires" : "",
327       "params" : [
328         {
329           "name" : "eventName",
330           "type" : "String",
331           "desc" : "",
332           "isOptional" : false
333         },
334         {
335           "name" : "args",
336           "type" : "Object...",
337           "desc" : "Variable number of parameters are passed to handlers",
338           "isOptional" : false
339         }
340       ],
341       "returns" : [
342         {
343           "name" : "",
344           "type" : "Boolean",
345           "desc" : "returns false if any of the handlers return false otherwise it returns true"
346         }
347       ]
348     },
349     {
350       "name" : "hasListener",
351       "type" : "function",
352       "desc" : "Checks to see if this object has any listeners for a specified event",
353       "sig" : "(eventName)",
354       "static" : false,
355       "memberOf" : "Roo.util.Observable",
356       "isStatic" : false,
357       "isConstructor" : false,
358       "isPrivate" : false,
359       "example" : "",
360       "deprecated" : "",
361       "since" : "",
362       "see" : "",
363       "exceptions" : "",
364       "requires" : "",
365       "params" : [
366         {
367           "name" : "eventName",
368           "type" : "String",
369           "desc" : "The name of the event to check for",
370           "isOptional" : false
371         }
372       ],
373       "returns" : [
374         {
375           "name" : "",
376           "type" : "Boolean",
377           "desc" : "True if the event is being listened for, else false"
378         }
379       ]
380     },
381     {
382       "name" : "capture",
383       "type" : "function",
384       "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.",
385       "sig" : "(o, fn, scope)",
386       "static" : true,
387       "memberOf" : "Roo.util.Observable",
388       "isStatic" : true,
389       "isConstructor" : false,
390       "isPrivate" : false,
391       "example" : "",
392       "deprecated" : "",
393       "since" : "",
394       "see" : "",
395       "exceptions" : "",
396       "requires" : "",
397       "params" : [
398         {
399           "name" : "o",
400           "type" : "Observable",
401           "desc" : "The Observable to capture",
402           "isOptional" : false
403         },
404         {
405           "name" : "fn",
406           "type" : "Function",
407           "desc" : "The function to call",
408           "isOptional" : false
409         },
410         {
411           "name" : "scope",
412           "type" : "Object",
413           "desc" : "(optional) The scope (this object) for the fn",
414           "isOptional" : false
415         }
416       ],
417       "returns" : []
418     },
419     {
420       "name" : "addListener",
421       "type" : "function",
422       "desc" : "Appends an event handler to this component",
423       "sig" : "(eventName, handler, scope, options)",
424       "static" : false,
425       "memberOf" : "Roo.util.Observable",
426       "isStatic" : false,
427       "isConstructor" : false,
428       "isPrivate" : false,
429       "example" : "",
430       "deprecated" : "",
431       "since" : "",
432       "see" : "",
433       "exceptions" : "",
434       "requires" : "",
435       "params" : [
436         {
437           "name" : "eventName",
438           "type" : "String",
439           "desc" : "The type of event to listen for",
440           "isOptional" : false
441         },
442         {
443           "name" : "handler",
444           "type" : "Function",
445           "desc" : "The method the event invokes",
446           "isOptional" : false
447         },
448         {
449           "name" : "scope",
450           "type" : "Object",
451           "desc" : "(optional) The scope in which to execute the handler\nfunction. The handler function's \"this\" context.",
452           "isOptional" : false
453         },
454         {
455           "name" : "options",
456           "type" : "Object",
457           "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>",
458           "isOptional" : false
459         }
460       ],
461       "returns" : []
462     }
463   ],
464   "events" : [
465     {
466       "name" : "create",
467       "type" : "function",
468       "desc" : "Fires before a node is created, enabling you to return custom Node types",
469       "sig" : "function (This, attr)\n{\n\n}",
470       "memberOf" : "",
471       "example" : "",
472       "deprecated" : "",
473       "since" : "",
474       "see" : "",
475       "params" : [
476         {
477           "name" : "This",
478           "type" : "Object",
479           "desc" : "TreeLoader object.",
480           "isOptional" : false
481         },
482         {
483           "name" : "attr",
484           "type" : "Object",
485           "desc" : "- the data returned from the AJAX call (modify it to suit)",
486           "isOptional" : false
487         }
488       ],
489       "returns" : []
490     },
491     {
492       "name" : "beforeload",
493       "type" : "function",
494       "desc" : "Fires before a network request is made to retrieve the Json text which specifies a node's children.",
495       "sig" : "function (This, node, callback)\n{\n\n}",
496       "memberOf" : "",
497       "example" : "",
498       "deprecated" : "",
499       "since" : "",
500       "see" : "",
501       "params" : [
502         {
503           "name" : "This",
504           "type" : "Object",
505           "desc" : "TreeLoader object.",
506           "isOptional" : false
507         },
508         {
509           "name" : "node",
510           "type" : "Object",
511           "desc" : "The {@link Roo.tree.TreeNode} object being loaded.",
512           "isOptional" : false
513         },
514         {
515           "name" : "callback",
516           "type" : "Object",
517           "desc" : "The callback function specified in the {@link #load} call.",
518           "isOptional" : false
519         }
520       ],
521       "returns" : []
522     },
523     {
524       "name" : "load",
525       "type" : "function",
526       "desc" : "Fires when the node has been successfuly loaded.",
527       "sig" : "function (This, node, response)\n{\n\n}",
528       "memberOf" : "",
529       "example" : "",
530       "deprecated" : "",
531       "since" : "",
532       "see" : "",
533       "params" : [
534         {
535           "name" : "This",
536           "type" : "Object",
537           "desc" : "TreeLoader object.",
538           "isOptional" : false
539         },
540         {
541           "name" : "node",
542           "type" : "Object",
543           "desc" : "The {@link Roo.tree.TreeNode} object being loaded.",
544           "isOptional" : false
545         },
546         {
547           "name" : "response",
548           "type" : "Object",
549           "desc" : "The response object containing the data from the server.",
550           "isOptional" : false
551         }
552       ],
553       "returns" : []
554     },
555     {
556       "name" : "loadexception",
557       "type" : "function",
558       "desc" : "Fires if the network request failed.",
559       "sig" : "function (This, node, response)\n{\n\n}",
560       "memberOf" : "",
561       "example" : "",
562       "deprecated" : "",
563       "since" : "",
564       "see" : "",
565       "params" : [
566         {
567           "name" : "This",
568           "type" : "Object",
569           "desc" : "TreeLoader object.",
570           "isOptional" : false
571         },
572         {
573           "name" : "node",
574           "type" : "Object",
575           "desc" : "The {@link Roo.tree.TreeNode} object being loaded.",
576           "isOptional" : false
577         },
578         {
579           "name" : "response",
580           "type" : "Object",
581           "desc" : "The response object containing the data from the server.",
582           "isOptional" : false
583         }
584       ],
585       "returns" : []
586     }
587   ]
588 }