PhpExt : Tree [ class tree ] [ index ] [ all elements ]

Class: PhpExt_Tree_TreeLoader

Source Location: /PhpExt/Tree/TreeLoader.php

Class PhpExt_Tree_TreeLoader

Class Overview

A TreeLoader provides for lazy loading of an PhpExt_Tree_TreeNode's child nodes from a specified URL. The response must be a JavaScript Array definition whose elements are node definition objects.

eg:

  1.  [{
  2.       id1,
  3.       text'A leaf Node',
  4.       leaftrue
  5.   },{
  6.       id2,
  7.       text'A folder Node',
  8.       children[{
  9.           id3,
  10.           text'A child Node',
  11.           leaftrue
  12.       }]
  13.  }]

A server request is sent, and child nodes are loaded only when a node is expanded. The loading node's id is passed to the server under the parameter name "node" to enable the server to produce the correct child nodes.

To pass extra parameters, an event handler may be attached to the "beforeload" event, and the parameters specified in the TreeLoader's baseParams property:

  1.  $loader->attachListener("beforeload"(
  2.             PhpExt_Javascript::functionDef(
  3.                 null,
  4.                 "treeLoader.baseParams.category = node.attributes.category;",
  5.                 array("treeLoader","node")
  6.             )
  7.         ));
This would pass an HTTP parameter called "category" to the server containing the value of the Node's "category" attribute.

Located in /PhpExt/Tree/TreeLoader.php [line 55]

PhpExt_Object
   |
   --PhpExt_Observable
      |
      --PhpExt_Tree_TreeLoader

Methods

[ Top ]
Method Summary
PhpExt_Tree_TreeLoader   __construct()  
array   getBaseAttrs()   (optional) An object containing attributes to be added to all nodes created by this loader. If the attributes sent by the server have an attribute in this object, they take priority.
array   getBaseParams()   (optional) An object containing properties which specify HTTP parameters to be passed to each request for child nodes.
boolean   getClearOnLoad()   (optional) Default to true. Remove previously existing child nodes before loading.
string   getDataUrl()   The URL from which to request a Json string which specifies an array of node definition objects representing the child nodes to be loaded.
boolean   getPreloadChildren()   If set to true, the loader recursively loads "children" attributes when doing the first load on nodes.
string   getRequestMethod()   The HTTP request method for loading data (defaults to the value of Ext.Ajax.method).
PhpExt_Tree_TreeNodeUI   getUiProvider()   (optional) An object containing properties which specify custom PhpExt_Tree_TreeNodeUI implementations. If the optional uiProvider attribute of a returned child node is a string rather than a reference to a TreeNodeUI implementation, then that string value is used as a property name in the uiProviders object.
string   getUrl()   Equivalent to dataUrl.
void   load()   Load an PhpExt_Tree_TreeNode from the URL specified in the constructor. This is called automatically when a node is expanded, but may be used to reload a node (or append new children if the clearOnLoad option is false.)
PhpExt_Tree_TreeLoader   setBaseAttrs()   (optional) An object containing attributes to be added to all nodes created by this loader. If the attributes sent by the server have an attribute in this object, they take priority.
PhpExt_Tree_TreeLoader   setBaseParams()   (optional) An object containing properties which specify HTTP parameters to be passed to each request for child nodes.
PhpExt_Tree_TreeLoader   setClearOnLoad()   (optional) Default to true. Remove previously existing child nodes before loading.
PhpExt_Tree_TreeLoader   setDataUrl()   The URL from which to request a Json string which specifies an array of node definition objects representing the child nodes to be loaded.
PhpExt_Tree_TreeLoader   setPreloadChildren()   If set to true, the loader recursively loads "children" attributes when doing the first load on nodes.
PhpExt_Tree_TreeLoader   setRequestMethod()   The HTTP request method for loading data (defaults to the value of Ext.Ajax.method).
PhpExt_Tree_TreeLoader   setUiProvider()   (optional) An object containing properties which specify custom PhpExt_Tree_TreeNodeUI implementations. If the optional uiProvider attribute of a returned child node is a string rather than a reference to a TreeNodeUI implementation, then that string value is used as a property name in the uiProviders object.
PhpExt_Tree_TreeLoader   setUrl()   Equivalent to dataUrl.

[ Top ]
Methods
Constructor __construct  [line 210]

  PhpExt_Tree_TreeLoader __construct( )


API Tags:
Access:  public


Redefinition of:
PhpExt_Observable::__construct()

[ Top ]
getBaseAttrs  [line 74]

  array getBaseAttrs( )

(optional) An object containing attributes to be added to all nodes created by this loader. If the attributes sent by the server have an attribute in this object, they take priority.


API Tags:
Access:  public


[ Top ]
getBaseParams  [line 92]

  array getBaseParams( )

(optional) An object containing properties which specify HTTP parameters to be passed to each request for child nodes.


API Tags:
Access:  public


[ Top ]
getClearOnLoad  [line 110]

  boolean getClearOnLoad( )

(optional) Default to true. Remove previously existing child nodes before loading.


API Tags:
Access:  public


[ Top ]
getDataUrl  [line 128]

  string getDataUrl( )

The URL from which to request a Json string which specifies an array of node definition objects representing the child nodes to be loaded.


API Tags:
Access:  public


[ Top ]
getPreloadChildren  [line 146]

  boolean getPreloadChildren( )

If set to true, the loader recursively loads "children" attributes when doing the first load on nodes.


API Tags:
Access:  public


[ Top ]
getRequestMethod  [line 170]

  string getRequestMethod( )

The HTTP request method for loading data (defaults to the value of Ext.Ajax.method).


API Tags:
See:  PhpExt_Tree_TreeLoader::METHOD_POST
See:  PhpExt_Tree_TreeLoader::METHOD_GET
Access:  public


[ Top ]
getUiProvider  [line 188]

  PhpExt_Tree_TreeNodeUI getUiProvider( )

(optional) An object containing properties which specify custom PhpExt_Tree_TreeNodeUI implementations. If the optional uiProvider attribute of a returned child node is a string rather than a reference to a TreeNodeUI implementation, then that string value is used as a property name in the uiProviders object.


API Tags:
Access:  public


[ Top ]
getUrl  [line 206]

  string getUrl( )

Equivalent to dataUrl.


API Tags:
Access:  public


[ Top ]
load  [line 232]

  void load( PhpExt_JavascriptStm $node, PhpExt_JavascriptStm $callback  )

Load an PhpExt_Tree_TreeNode from the URL specified in the constructor. This is called automatically when a node is expanded, but may be used to reload a node (or append new children if the clearOnLoad option is false.)

Parameters:
PhpExt_JavascriptStm   $node:  Ext.tree.TreeNode reference
Ext.tree.TreeNode   $callback:  Callback function

API Tags:
Access:  public


[ Top ]
setBaseAttrs  [line 66]

  PhpExt_Tree_TreeLoader setBaseAttrs( array $value  )

(optional) An object containing attributes to be added to all nodes created by this loader. If the attributes sent by the server have an attribute in this object, they take priority.

Parameters:
array   $value: 

API Tags:
Access:  public


[ Top ]
setBaseParams  [line 84]

  PhpExt_Tree_TreeLoader setBaseParams( array $value  )

(optional) An object containing properties which specify HTTP parameters to be passed to each request for child nodes.

Parameters:
array   $value: 

API Tags:
Access:  public


[ Top ]
setClearOnLoad  [line 102]

  PhpExt_Tree_TreeLoader setClearOnLoad( boolean $value  )

(optional) Default to true. Remove previously existing child nodes before loading.

Parameters:
boolean   $value: 

API Tags:
Access:  public


[ Top ]
setDataUrl  [line 120]

  PhpExt_Tree_TreeLoader setDataUrl( string $value  )

The URL from which to request a Json string which specifies an array of node definition objects representing the child nodes to be loaded.

Parameters:
string   $value: 

API Tags:
Access:  public


[ Top ]
setPreloadChildren  [line 138]

  PhpExt_Tree_TreeLoader setPreloadChildren( boolean $value  )

If set to true, the loader recursively loads "children" attributes when doing the first load on nodes.

Parameters:
boolean   $value: 

API Tags:
Access:  public


[ Top ]
setRequestMethod  [line 159]

  PhpExt_Tree_TreeLoader setRequestMethod( string $value  )

The HTTP request method for loading data (defaults to the value of Ext.Ajax.method).

Parameters:
string   $value: 

API Tags:
See:  PhpExt_Tree_TreeLoader::METHOD_POST
See:  PhpExt_Tree_TreeLoader::METHOD_GET
Access:  public


[ Top ]
setUiProvider  [line 180]

  PhpExt_Tree_TreeLoader setUiProvider( PhpExt_Tree_TreeNodeUI $value  )

(optional) An object containing properties which specify custom PhpExt_Tree_TreeNodeUI implementations. If the optional uiProvider attribute of a returned child node is a string rather than a reference to a TreeNodeUI implementation, then that string value is used as a property name in the uiProviders object.

Parameters:
PhpExt_Tree_TreeNodeUI   $value: 

API Tags:
Access:  public


[ Top ]
setUrl  [line 198]

  PhpExt_Tree_TreeLoader setUrl( string $value  )

Equivalent to dataUrl.

Parameters:
string   $value: 

API Tags:
Access:  public


[ Top ]
Constants
METHOD_GET = 'GET' [line 57]

[ Top ]
METHOD_POST = 'POST' [line 58]

[ Top ]

Documentation generated on Fri, 08 Aug 2008 16:01:55 -0500 by phpDocumentor 1.4.0