Perl code for user selectable columns in the data table.

This commit is contained in:
Colin Kuskie 2009-01-30 09:21:05 -08:00 committed by Patrick Donelan
parent efe62bae1e
commit bd38691cf0
3 changed files with 12 additions and 3 deletions

View file

@ -125,6 +125,7 @@ sub getDataTemplateVars {
my $self = shift; my $self = shift;
my $json = $self->getDataJson; my $json = $self->getDataJson;
$self->session->log->warn($json);
my $dt = JSON->new->decode($json); my $dt = JSON->new->decode($json);
# Make row data more friendly to templates # Make row data more friendly to templates

View file

@ -122,11 +122,11 @@ sub getDataTableHtml {
# Not using a datastructure and JSON.pm because of function references for "parser" # Not using a datastructure and JSON.pm because of function references for "parser"
my $columnDef my $columnDef
= '{' = '{'
. qq["key" : "$column->{ key }", ] . qq["key" : "$column->{ key }", ]
. qq["abbr" : "$column->{ key }", ] . qq["abbr" : "$column->{ key }", ]
. qq["formatter" : "$column->{ formatter }", ] . qq["formatter" : "$column->{ formatter }", ]
. qq["resizable" : 1, ] . qq["resizable" : 1, ]
. qq["sortable" : 1]; . qq["sortable" : $column->{sortable} ];
# Automatically determine the parser to use # Automatically determine the parser to use
if ( $parsers{ $column->{formatter} } ) { if ( $parsers{ $column->{formatter} } ) {
@ -186,6 +186,7 @@ sub getDefaultValue {
columns => [ { columns => [ {
key => "New Column", key => "New Column",
formatter => "text", formatter => "text",
sortable => "true",
}, },
], ],
rows => [ { "New Column" => "Value", }, ], rows => [ { "New Column" => "Value", }, ],

View file

@ -139,6 +139,13 @@ our $I18N = {
lastUpdated => 0, lastUpdated => 0,
context => q{Button to delete a column, shown in the Edit Schema dialog}, context => q{Button to delete a column, shown in the Edit Schema dialog},
}, },
"sortable" => {
message => q{sortable},
lastUpdated => 0,
context => q{Whether a column is sortable in the table},
},
}; };
1; 1;