Skip to content

Commit

Permalink
corrected sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
kjgarza committed Feb 7, 2019
1 parent 2196845 commit f6e8dcb
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 6 deletions.
6 changes: 5 additions & 1 deletion source/includes/_javascripts.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<script src="/javascripts/browser-support.js"></script>
<script src="/javascripts/jquery-1.9.1.min.js"></script>

<script
src="https://code.jquery.com/jquery-3.3.1.min.js"
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
crossorigin="anonymous"></script>
<script src="/javascripts/jquery-ui-1.8.18.custom.min.js"></script>
<script src="/javascripts/jquery-custom.js"></script>
<script src="/javascripts/jquery.tablesorter.min.js"></script>
Expand Down
32 changes: 27 additions & 5 deletions source/javascripts/stats/tabulator.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,17 @@ function goToPrefixes(cell) {
});
}

function goToResolutions(cell) {
var prefix = cell.target.innerText.toLowerCase();
window.location = '/resolutions.html#tab-resolution-report';
ga("send", {
hitType: 'event',
eventCategory: 'stats',
eventAction: 'filterClient',
eventLabel: client
});
}


function getCsv(){
table.download("csv", "data.csv");
Expand All @@ -47,12 +58,20 @@ function queryDatacite(url, config, params){
// there is a bug described in https://github.com/olifolkerd/tabulator/issues/1612
return new Promise(function(resolve, reject){
//do some async data retrieval then pass the array of row data back into Tabulator

$.ajax({
type : "GET",
url : url,
dataType : "json",
cache : true,
// async : true,
jsonp: false,
dataType : "json",
headers: {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': 'GET',
'Access-Control-Allow-Headers': 'Cache-Control',
'Cache-Control':'public, max-age=100000'
},
async : true,
success : function(data) {
resolve(data);
}
Expand All @@ -68,7 +87,10 @@ function whichEvent(cell){
console.log(current)
if(current.includes("clients")){
goToPrefixes(cell);
}else{
}else if (current.includes("prefixes")) {
goToResolutions(cell);
}
else{
goToClients(cell);
}
}
Expand Down Expand Up @@ -108,7 +130,7 @@ var table = new Tabulator("#doi-production-table", {
var draft = (typeof draft === 'undefined') ? {"count":"0"} : draft;

return {"id": element.id,
"title": element.title,
"title": element.title,
"total": element.count,
"findable": findable.count,
"registered": registered.count,
Expand All @@ -126,7 +148,7 @@ var table = new Tabulator("#doi-production-table", {
{title:"Name", field:"title", minWidth:350, responsive:0},
{title:"DOI Registrations", align:"center",
columns:[
{title:"Total", field:"total", sorter:"string", align:"right", formatter:"money", bottomCalc:"sum",formatterParams:{precision:false,formatter:"money", thousand:","},bottomCalcformatterParams:{precision:false, thousand:","}},
{title:"Total", field:"total", sorter:"number", align:"right", formatter:"money", bottomCalc:"sum",formatterParams:{precision:false,formatter:"money", thousand:","},bottomCalcformatterParams:{precision:false, thousand:","}},
{title:"2019", field:"this_year", align:"right", formatter:"money", bottomCalc:"sum",formatterParams:{precision:false, thousand:","},bottomCalcformatterParams:{precision:false, formatter:"money",thousand:","}},
{title:"2018", field:"last_year", align:"right", formatter:"money", bottomCalc:"sum",formatterParams:{precision:false, thousand:","},bottomCalcformatterParams:{precision:false, formatter:"money",thousand:","}},
{title:"This month", field:"this_month", align:"right", formatter:"money", bottomCalc:"sum",formatterParams:{precision:false, thousand:","},bottomCalcformatterParams:{precision:false,formatter:"money", thousand:","}},
Expand Down

0 comments on commit f6e8dcb

Please sign in to comment.