diff options
author | ivan <ivan> | 2009-09-25 10:14:30 +0000 |
---|---|---|
committer | ivan <ivan> | 2009-09-25 10:14:30 +0000 |
commit | 81e426fe755eaea508041bc2d7b25ac44c777434 (patch) | |
tree | 95a9a5fe952a77274f40e660400415e6b2db2997 /httemplate/elements/select-table.html | |
parent | 25b0525eb1f0d018b893a7bdc96b92a8f446020f (diff) |
nomadix, RT#5876
Diffstat (limited to 'httemplate/elements/select-table.html')
-rw-r--r-- | httemplate/elements/select-table.html | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/httemplate/elements/select-table.html b/httemplate/elements/select-table.html index 1a440f07e..10a8b2741 100644 --- a/httemplate/elements/select-table.html +++ b/httemplate/elements/select-table.html @@ -34,6 +34,7 @@ Example: 'empty_label' => '', #better specify it though, the default might change 'multiple' => 0, # bool 'disable_empty' => 0, # bool (implied by multiple) + 'label_showkey' => 0, # bool 'label_callback' => sub { my $record = shift; return "label"; }, #more params controlling HTML stuff about the <SELECT> @@ -77,13 +78,19 @@ Example: <OPTION VALUE=""><% $opt{'empty_label'} || 'all' %> % } -% foreach my $record ( sort { $a->$name_col() cmp $b->$name_col() } @records ) { +% foreach my $record ( sort { $a->$name_col() cmp $b->$name_col() +% || $a->$key() <=> $b->$key() +% } +% @records +% ) +% { % my $recvalue = $record->$key(); <OPTION VALUE="<% $recvalue %>" <% ref($value) && $value->{$recvalue} || $value == $recvalue ? ' SELECTED' : '' %> - ><% $opt{'label_callback'} + ><% $opt{'label_showkey'} ? "$recvalue: " : '' %> + <% $opt{'label_callback'} ? &{ $opt{'label_callback'} }( $record ) : $record->$name_col() %> |