mirror of
https://github.com/johrpan/geposanui.git
synced 2025-10-26 11:17:24 +01:00
Move results page to separate module
This commit is contained in:
parent
bd3446716b
commit
7f0090620b
4 changed files with 276 additions and 248 deletions
14
R/details.R
14
R/details.R
|
|
@ -104,7 +104,7 @@ details_server <- function(id, filtered_results) {
|
|||
rownames = FALSE,
|
||||
colnames = column_names,
|
||||
options = list(
|
||||
rowCallback = js_link,
|
||||
rowCallback = js_link(),
|
||||
columnDefs = list(list(visible = FALSE, targets = 2)),
|
||||
pageLength = 25
|
||||
)
|
||||
|
|
@ -118,3 +118,15 @@ details_server <- function(id, filtered_results) {
|
|||
})
|
||||
})
|
||||
}
|
||||
|
||||
#' Generate a JavaScript function to replace gene IDs with Ensembl gene links.
|
||||
#' @noRd
|
||||
js_link <- function() {
|
||||
DT::JS("function(row, data) {
|
||||
let id = data[1];
|
||||
var name = data[2];
|
||||
if (!name) name = 'Unknown';
|
||||
let url = `https://www.ensembl.org/Homo_sapiens/Gene/Summary?g=${id}`;
|
||||
$('td:eq(1)', row).html(`<a href=\"${url}\" target=\"_blank\">${name}</a>`);
|
||||
}")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue