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