Tree::Simple::View::DHTML::DHTML Examples
For each example given, we show the code, followed by the results of the HTML it produces. These bare all DHTML examples, so the tree can be expanded and collapsed by clicking on the links.
my $tree_view = Tree::Simple::View::DHTML->new($tree);
print $tree_view->javascript();
print $tree_view->expandAll();
- Tree-Simple-View
- lib
- Makefile.PL
- MANIFEST
- README
- Changes
- t
- 10_Tree_Simple_View_test.t
- 20_Tree_Simple_View_HTML_test.t
- 30_Tree_Simple_View_DHTML_test.t
my $tree_view = Tree::Simple::View::DHTML->new($tree);
print $tree_view->javascript();
print $tree_view->expandPath(qw(Tree-Simple-View lib Tree));
- Tree-Simple-View
- lib
- Makefile.PL
- MANIFEST
- README
- Changes
- t
- 10_Tree_Simple_View_test.t
- 20_Tree_Simple_View_HTML_test.t
- 30_Tree_Simple_View_DHTML_test.t
# view source to see the CSS class definitions
my $tree_view = Tree::Simple::View::DHTML->new($tree => (
list_css_class => "listClass",
list_item_css_class => "listItemClass",
expanded_item_css_class => "expandedItemClass",
link_css_class => "linkClass",
node_formatter => sub {
my ($t) = @_;
# add a trailing slash to all our 'directories'
return $t->getNodeValue() . "/" unless $t->isLeaf();
return $t->getNodeValue();
}
));
print $tree_view->javascript();
print $tree_view->expandAll();
- Tree-Simple-View/
- lib/
- Makefile.PL
- MANIFEST
- README
- Changes
- t/
- 10_Tree_Simple_View_test.t
- 20_Tree_Simple_View_HTML_test.t
- 30_Tree_Simple_View_DHTML_test.t
# view source to see the CSS class definitions
my $tree_view = Tree::Simple::View::DHTML->new($tree => (
list_css_class => "listClass",
list_item_css_class => "listItemClass",
expanded_item_css_class => "expandedItemClass",
link_css_class => "linkClass",
node_formatter => sub {
my ($t) = @_;
# add a trailing slash to all our 'directories'
return $t->getNodeValue() . "/" unless $t->isLeaf();
return $t->getNodeValue();
}
));
print $tree_view->javascript();
print $tree_view->expandPath(qw(Tree-Simple-View lib Tree Simple));
- Tree-Simple-View/
- lib/
- Makefile.PL
- MANIFEST
- README
- Changes
- t/
- 10_Tree_Simple_View_test.t
- 20_Tree_Simple_View_HTML_test.t
- 30_Tree_Simple_View_DHTML_test.t
my $tree_view = Tree::Simple::View::DHTML->new(Tree::Simple=HASH(0x1806a04) => (
list_css => "font-family: Times",
list_item_css => "list-style: circle;",
expanded_item_css => "list-style: none;",
link_css => "color: #336699;",
form_element_formatter => sub {
my ($t) = @_;
return "<INPUT TYPE='checkbox' NAME='tree_id' onClick='alert(this.value)' VALUE='" . $t->getNodeValue() . "'>"
}
));
print $tree_view->javascript();
print $tree_view->expandAll();
my $tree_view = Tree::Simple::View::DHTML->new(Tree::Simple=HASH(0x1806a04) => (
list_css => "font-family: Times",
list_item_css => "list-style: circle;",
expanded_item_css => "list-style: none;",
link_css => "color: #336699;",
form_element_formatter => sub {
my ($t) = @_;
return "<INPUT TYPE='checkbox' NAME='tree_id' onClick='alert(this.value)' VALUE='" . $t->getNodeValue() . "'>"
}
));
print $tree_view->javascript();
print $tree_view->expandPath(qw(Tree-Simple-View t));