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