| HTML-FormFu-ExtJS documentation | Contained in the HTML-FormFu-ExtJS distribution. |
HTML::FormFu::ExtJS::Element::ComboBox
version 0.090
Creates an editable select box.
The default ExtJS setup is:
"mode" : "local", "editable" : true, "displayField" : "text", "valueField" : "value", "autoWidth" : false, "forceSelection" : true, "triggerAction" : "all", "store" : new Ext.data.SimpleStore( ... ), "xtype" : "combo"
HTML::FormFu::ExtJS::Element::ComboBox - An editable select box
Copyright 2009 Moritz Onken, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Moritz Onken <onken@netcubed.de>
This software is Copyright (c) 2011 by Moritz Onken.
This is free software, licensed under:
The (three-clause) BSD License
| HTML-FormFu-ExtJS documentation | Contained in the HTML-FormFu-ExtJS distribution. |
# # This file is part of HTML-FormFu-ExtJS # # This software is Copyright (c) 2011 by Moritz Onken. # # This is free software, licensed under: # # The (three-clause) BSD License # package HTML::FormFu::ExtJS::Element::ComboBox; BEGIN { $HTML::FormFu::ExtJS::Element::ComboBox::VERSION = '0.090'; } use base "HTML::FormFu::ExtJS::Element::Select"; use strict; use warnings; use utf8; use JavaScript::Dumper; sub render { my $class = shift; my $self = shift; my $super = $class->SUPER::render($self); my $data; foreach my $option ( @{ $self->options } ) { push( @{$data}, [ $option->{value}, $option->{label} ] ); if ( $option->{group} && ( my @groups = @{ $option->{group} } ) ) { foreach my $item (@groups) { push( @{$data}, [ $item->{value}, $item->{label} ] ); } } } my $string = js_dumper( { fields => [ "value", "text" ], data => $data } ); return { %{$super}, editable => \1, store => \( "new Ext.data.SimpleStore(" . $string . ")" ), }; } 1; __END__