Tracker: sort numbers and fractions numerically
This commit is contained in:
parent
d1fd1cd788
commit
4b495557cd
|
@ -23,20 +23,40 @@ window.addEventListener('load', () => {
|
||||||
render: function (data, type, row) {
|
render: function (data, type, row) {
|
||||||
if (type === "sort" || type === 'type') {
|
if (type === "sort" || type === 'type') {
|
||||||
if (data === "None")
|
if (data === "None")
|
||||||
return -1
|
return -1;
|
||||||
|
|
||||||
return parseInt(data);
|
return parseInt(data);
|
||||||
}
|
}
|
||||||
if (data === "None")
|
if (data === "None")
|
||||||
return data
|
return data;
|
||||||
|
|
||||||
var hours = Math.floor(data / 3600);
|
let hours = Math.floor(data / 3600);
|
||||||
var minutes = Math.floor((data - (hours * 3600)) / 60);
|
let minutes = Math.floor((data - (hours * 3600)) / 60);
|
||||||
|
|
||||||
if (minutes < 10) {minutes = "0"+minutes;}
|
if (minutes < 10) {minutes = "0"+minutes;}
|
||||||
return hours+':'+minutes;
|
return hours+':'+minutes;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
targets: 'number',
|
||||||
|
render: function (data, type, row) {
|
||||||
|
if (type === "sort" || type === 'type') {
|
||||||
|
return parseFloat(data);
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
targets: 'fraction',
|
||||||
|
render: function (data, type, row) {
|
||||||
|
let splitted = data.split("/", 1);
|
||||||
|
let current = splitted[0]
|
||||||
|
if (type === "sort" || type === 'type') {
|
||||||
|
return parseInt(current);
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
},
|
||||||
],
|
],
|
||||||
|
|
||||||
// DO NOT use the scrollX or scrollY options. They cause DataTables to split the thead from
|
// DO NOT use the scrollX or scrollY options. They cause DataTables to split the thead from
|
||||||
|
|
|
@ -102,16 +102,16 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
{% for area in ordered_areas %}
|
{% for area in ordered_areas %}
|
||||||
<th class="center-column lower-row">
|
<th class="center-column lower-row fraction">
|
||||||
<img class="alttp-sprite" src="{{ icons["Chest"] }}" alt="Checks">
|
<img class="alttp-sprite" src="{{ icons["Chest"] }}" alt="Checks">
|
||||||
</th>
|
</th>
|
||||||
{% if area in key_locations %}
|
{% if area in key_locations %}
|
||||||
<th class="center-column lower-row">
|
<th class="center-column lower-row number">
|
||||||
<img class="alttp-sprite" src="{{ icons["Small Key"] }}" alt="Small Key">
|
<img class="alttp-sprite" src="{{ icons["Small Key"] }}" alt="Small Key">
|
||||||
</th>
|
</th>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if area in big_key_locations %}
|
{% if area in big_key_locations %}
|
||||||
<th class="center-column lower-row">
|
<th class="center-column lower-row number">
|
||||||
<img class="alttp-sprite" src="{{ icons["Big Key"] }}" alt="Big Key">
|
<img class="alttp-sprite" src="{{ icons["Big Key"] }}" alt="Big Key">
|
||||||
</th>
|
</th>
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
|
|
Loading…
Reference in New Issue