HTML::PopupTreeSelect::Dynamic - dynamic version of HTML::PopupTreeSelect
This module is used just like HTML::PopupTreeSelect,
with the addition of 3 new parameters -
Here's a full example:
A complete, and terribly coded, example of how to use this modules is included in the module distribution. Look for the file called
This module provides a dynamic version of HTML::PopupTreeSelect. By dynamic I mean that the tree is sent to the client in chunks as the user clicks around the tree. In HTML::PopupTreeSelect the entire tree is sent to the client when the page is loaded, introducing a long delay for large trees. With HTML::PopupTreeSelect::Dynamic trees of virtually any size can be navigated without noticable delays.
Be aware of the following issues, some or all of which may be fixed in a future version:
dataparameter to new(). In general this is considerably less problematic than sending the entire tree to the client, but it would be nice to remove this potential bottleneck as well.
I have personally tested Firefox v1.0.2 on Linux and IE 6 on Windows XP.
This module has the same interface as HTML::PopupTreeSelect, with a few additions:
This option provides the URL which will be used for callbacks from the widget to get node data. For example:
$select = HTML::PopupTreeSelect::Dynamic->new( dynamic_url => 'http://example.com/tree_select.cgi', ...);
This will cause the widget to make dynamic (AJAX) requests to http://example.com/tree_select.cgi to request node data. The code running behind this URL should call handle_get_node(), shown below.
This option provides additional parameters to be added to the request to
dynamic_url. These should be in URL format. For example, to set "rm" to "get_node":
$select = HTML::PopupTreeSelect::Dynamic->new( dynamic_params => 'rm=get_node', ...);
This options surpress the output of the
Prototype.js that comes from HTML::Prototype. By default it is
It is useful to set this option to
false when you are already using prototype.js in your templates via a
This method must be called when your application recieves a request using
dynamic_params. A CGI.pm object containing the data from this query must be passed as a named parameter:
$output = $select->handle_get_node(query => $query);
The return value is the output to be returned to browser.
I know of no bugs in this module. If you find one, please file a bug report at:
Alternately you can email me directly at
email@example.com. Please include the version of the module and a complete test case that demonstrates the bug.
Copyright (C) 2005 Sam Tregar
This program is free software; you can redistribute it and/or modify it under the same terms as Perl 5 itself.
Sam Tregar <firstname.lastname@example.org>