aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzsloan2020-08-03 11:05:27 -0500
committerzsloan2020-08-03 11:05:27 -0500
commit497a64f4c24644217fe74178976ba5cb9e675308 (patch)
tree8276ade49bc1ec8f7292ab89a6508fb4dd7d0710
parent317d7a78930ecf4be8ec80bd688c14baa8852f04 (diff)
downloadgenenetwork2-497a64f4c24644217fe74178976ba5cb9e675308.tar.gz
Fixed issue where DataTables was initialized twice when selecting
cofactors, leading to an error in non-Chrome browsers * wqflask/wqflask/static/new/javascript/get_covariates_from_collection.js - Added a line that checks if the table already exists before initializing it; this issue is caused by a circular import issue, but I'm not sure how to get around it yet
-rw-r--r--wqflask/wqflask/static/new/javascript/get_covariates_from_collection.js48
1 files changed, 25 insertions, 23 deletions
diff --git a/wqflask/wqflask/static/new/javascript/get_covariates_from_collection.js b/wqflask/wqflask/static/new/javascript/get_covariates_from_collection.js
index 934cc14d..a8a3041d 100644
--- a/wqflask/wqflask/static/new/javascript/get_covariates_from_collection.js
+++ b/wqflask/wqflask/static/new/javascript/get_covariates_from_collection.js
@@ -37,29 +37,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;