-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #128 from Anjalbaral/fixed-table-header
Fixed table header
- Loading branch information
Showing
12 changed files
with
176 additions
and
60 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<link rel="stylesheet" href="../vendor/bootstrap.min.css"> | ||
<link rel="stylesheet" href="../maptable.css"> | ||
<title>MapTable example</title> | ||
<style> | ||
.table thead { | ||
background-color:#fff; | ||
} | ||
</style> | ||
</head> | ||
|
||
<body> | ||
|
||
<script src="../vendor/d3.min.js" charset="utf-8"></script> | ||
<script src="../vendor/topojson.min.js"></script> | ||
<script src="../maptable.js"></script> | ||
|
||
<div class="container"> | ||
<div class="panel panel-default"> | ||
<div class="panel-heading">[Example] Table with fixed header</div> | ||
<div class="panel-body"> | ||
Demonstating: rendering a table and filters with fixed table header<br /> | ||
<br> | ||
<div class="btn-group"> | ||
<a href="./table-with-fixed-header.html" target="_blank" class="btn btn-default">Open in a new window</a> | ||
<a href="https://github.com/Packet-Clearing-House/maptable/tree/master/docs/examples/table-with-fixed-header.html" target="_blank" | ||
class="btn btn-default">View source code</a> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div id="vizContainer"></div> | ||
</div> | ||
<script> | ||
var viz = d3.maptable('#vizContainer') | ||
.json('table.json') | ||
.columns({ | ||
position: { | ||
filterMethod: 'dropdown', | ||
}, | ||
office: { | ||
filterMethod: 'dropdown', | ||
}, | ||
start_date: { | ||
filterMethod: 'compare', | ||
filterInputType: 'date', | ||
dataParse: function (val) { | ||
return new Date(val).getTime(); | ||
} | ||
}, | ||
salary: { | ||
filterMethod: 'compare', | ||
filterInputType: 'number', | ||
cellContent: function (d) { | ||
const v = parseInt(d.salary.replace(/[^0-9]+/g, ''), 10); | ||
return '$' + v.toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,'); | ||
}, | ||
dataParse: function (val) { | ||
return parseInt(val.replace(/[^0-9]+/g, ''), 10); | ||
} | ||
}, | ||
links: { | ||
virtual: function (d) { | ||
return '<a href="#' + d.extn + '">Link</a>'; | ||
} | ||
} | ||
}) | ||
.filters({ | ||
show: ['name', 'position', 'office', 'salary', 'start_date'] | ||
}) | ||
.table({ | ||
show: ['name', 'position', 'office', 'salary', 'start_date', 'links'], | ||
header: {className: "mt-header-fixed", top: 0} | ||
}) | ||
.render(); | ||
</script> | ||
|
||
|
||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.