Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sorting IP adresses and uptime in tables #435

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions puppetboard/templates/_macros.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,21 @@
"search": {"regex": true},
// Default sort
"order": [[ 0, "desc" ]],
//Sort ip adresses and parse integers where applicable
"columnDefs": [

{ type: 'ip-address', targets: 1 },

{"targets": -1,
"render": function ( data, type, row )
{if (isNaN(parseInt(data)))
return (data)
else
return parseInt(data)}
},
],
// Custom options
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate comment


// Custom options
{% if extra_options %}{% call extra_options() %}Callback to parent defined options{% endcall %}{% endif %}
});
Expand Down
1 change: 1 addition & 0 deletions puppetboard/templates/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/datatables/1.10.13/js/jquery.dataTables.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/datatables/1.10.13/js/dataTables.semanticui.min.js"></script>
<script src="//cdn.datatables.net/plug-ins/1.10.16/sorting/ip-address.js"></script>
{% if config.LOCALISE_TIMESTAMP %}
<script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.7.0/moment.min.js"></script>
{% endif %}
Expand Down