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