diff options
author | zsloan | 2020-07-15 13:49:34 -0500 |
---|---|---|
committer | BonfaceKilz | 2020-07-24 03:46:26 +0300 |
commit | 34aa368b6a17fdfa6817633714558a989300cbc1 (patch) | |
tree | d41c9d5b41da270be375017cc1a513e2cb9099d2 | |
parent | 97d5ba1edde511133c5483bd41b5903a089d3c7e (diff) | |
download | genenetwork2-34aa368b6a17fdfa6817633714558a989300cbc1.tar.gz |
Fixed issue where DataTable was getting initialized twice when adding cofactors to a scatterplot + fixed issue where sizev and datav sometimes weren't set when drawing scatterplot
-rw-r--r-- | wqflask/wqflask/static/new/javascript/draw_corr_scatterplot.js | 5 | ||||
-rw-r--r-- | wqflask/wqflask/static/new/javascript/get_traits_from_collection.js | 48 |
2 files changed, 27 insertions, 26 deletions
diff --git a/wqflask/wqflask/static/new/javascript/draw_corr_scatterplot.js b/wqflask/wqflask/static/new/javascript/draw_corr_scatterplot.js index 956e0467..1bae8773 100644 --- a/wqflask/wqflask/static/new/javascript/draw_corr_scatterplot.js +++ b/wqflask/wqflask/static/new/javascript/draw_corr_scatterplot.js @@ -337,14 +337,13 @@ function getdata() { continue } + sizev = 10; + datav = 0; if (size_cofactor_vals.length > 0){ if (cofactor_samples.indexOf(js_data.indIDs[j])) { datav = size_cofactor_vals[j] sizev = map1to2(datamin, datamax, sizemin, sizemax, datav); } - } else { - datav = 0; - sizev = 10; } x_values.push(js_data.data[0][j]) diff --git a/wqflask/wqflask/static/new/javascript/get_traits_from_collection.js b/wqflask/wqflask/static/new/javascript/get_traits_from_collection.js index 6f03b98f..4ec62157 100644 --- a/wqflask/wqflask/static/new/javascript/get_traits_from_collection.js +++ b/wqflask/wqflask/static/new/javascript/get_traits_from_collection.js @@ -41,29 +41,31 @@ $('#trait_table').dataTable( { "orderClasses": true } ); -$('#collection_table').dataTable( { - "createdRow": function ( row, data, index ) { - if ($('td', row).eq(2).text().length > 40) { - $('td', row).eq(2).text($('td', row).eq(2).text().substring(0, 40)); - $('td', row).eq(2).text($('td', row).eq(2).text() + '...') - } - if ($('td', row).eq(4).text().length > 50) { - $('td', row).eq(4).text($('td', row).eq(4).text().substring(0, 50)); - $('td', row).eq(4).text($('td', row).eq(4).text() + '...') - } - }, - "columnDefs": [ { - "targets": 0, - "orderable": false - } ], - "order": [[1, "asc" ]], - "sDom": "ZRtr", - "iDisplayLength": -1, - "autoWidth": true, - "bSortClasses": false, - "paging": false, - "orderClasses": true -} ); +if ( ! $.fn.DataTable.isDataTable( '#collection_table' ) ) { + $('#collection_table').dataTable( { + "createdRow": function ( row, data, index ) { + if ($('td', row).eq(2).text().length > 40) { + $('td', row).eq(2).text($('td', row).eq(2).text().substring(0, 40)); + $('td', row).eq(2).text($('td', row).eq(2).text() + '...') + } + if ($('td', row).eq(4).text().length > 50) { + $('td', row).eq(4).text($('td', row).eq(4).text().substring(0, 50)); + $('td', row).eq(4).text($('td', row).eq(4).text() + '...') + } + }, + "columnDefs": [ { + "targets": 0, + "orderable": false + } ], + "order": [[1, "asc" ]], + "sDom": "ZRtr", + "iDisplayLength": -1, + "autoWidth": true, + "bSortClasses": false, + "paging": false, + "orderClasses": true + } ); +} collection_click = function() { var this_collection_url; |