From fff8bcc4c35521655972a94ac11e351bab50dcb8 Mon Sep 17 00:00:00 2001 From: titima15 Date: Fri, 3 Jun 2022 21:43:43 +0000 Subject: [PATCH] modified table --- lib/SGN/Controller/AJAX/Search/Cross.pm | 23 +++++++++++++- mason/breeders_toolbox/cross/all_cross_entries.mas | 36 +++++++++++----------- 2 files changed, 40 insertions(+), 19 deletions(-) diff --git a/lib/SGN/Controller/AJAX/Search/Cross.pm b/lib/SGN/Controller/AJAX/Search/Cross.pm index 4a5efeea7..5d05625a8 100644 --- a/lib/SGN/Controller/AJAX/Search/Cross.pm +++ b/lib/SGN/Controller/AJAX/Search/Cross.pm @@ -201,8 +201,29 @@ sub search_all_cross_entries : Path('/ajax/search/all_cross_entries') :Args(0) { my $crosses = CXGN::Cross->new({schema => $schema}); my $result = $crosses->get_all_cross_entries(); + my @all_crosses; + foreach my $r (@$result){ + my ($cross_id, $cross_name, $cross_type, $female_id, $female_name, $female_ploidy, $male_id, $male_name, $male_ploidy, $pollination_date, $number_of_seeds, $progeny_count, $project_id, $project_name ) =@$r; + push @all_crosses, { + cross_id => $cross_id, + cross_name => $cross_name, + cross_type => $cross_type, + female_id => $female_id, + female_name => $female_name, + female_ploidy => $female_ploidy, + male_id => $male_id, + male_name => $male_name, + male_ploidy => $male_ploidy, + pollination_date => $pollination_date, + number_of_seeds => $number_of_seeds, + progeny_count => $progeny_count, + project_id => $project_id, + project_name => $project_name + }; + } + + $c->stash->{rest} = { data => \@all_crosses }; - $c->stash->{rest}={ data=> $result}; } diff --git a/mason/breeders_toolbox/cross/all_cross_entries.mas b/mason/breeders_toolbox/cross/all_cross_entries.mas index ec2777ce9..f49b4919e 100644 --- a/mason/breeders_toolbox/cross/all_cross_entries.mas +++ b/mason/breeders_toolbox/cross/all_cross_entries.mas @@ -7,24 +7,6 @@
- - - - - - - - - - - - - - - - - -
1234567891011121314
@@ -37,6 +19,24 @@ jQuery(document).ready(function(){ jQuery('#all_cross_entries_table').DataTable({ 'destroy': true, 'ajax':'/ajax/search/all_cross_entries', + columns: [ + { title: "Cross Unique ID", "data": null, "render": function ( data, type, row ) { return ""+row.cross_name+""; } }, + { title: "Cross Type", "data": "cross_type" }, + { title: "Female Parent", "data": null, "render": function ( data, type, row ) { return ""+row.female_name+""; } }, + { title: "Female Ploidy", "data": "female_ploidy" }, + { title: "Male Parent", "data": null, "render": function ( data, type, row ) { + if (row.male_parent_id === null){ + return 'NA'; + } else { + return ""+row.male_name+""; + } + }}, + { title: "Male Ploidy", "data": "male_ploidy" }, + { title: "Pollination Date", "data": "pollination_date" }, + { title: "Number of Seeds", "data": "number_of_seeds" }, + { title: "Number of Progenies", "data": "progeny_count" }, + { title: "Crossing Experiment", "data": null, "render": function ( data, type, row ) { return ""+row.project_name+""; } }, + ], }); }); -- 2.11.4.GIT