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