-
Notifications
You must be signed in to change notification settings - Fork 354
Column filters #62
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
Open
rvelseg
wants to merge
20
commits into
derekeder:master
Choose a base branch
from
rvelseg:column_filters
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+19
−1
Open
Column filters #62
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
dd0eba1
input fields
rvelseg f3e4090
bugfix
rvelseg dd6abd2
trying to add an event
rvelseg c351d01
another try
rvelseg 6eb568f
bugfix
rvelseg f5d5113
more ambitious function
rvelseg ebc01d8
tryng to make a global variable
rvelseg 41c059f
another try
rvelseg fd0ce9d
using the global variable
rvelseg d99d225
column number
rvelseg 92664fc
bugfix
rvelseg 1492913
trynig to move sorting funtionality to column header
rvelseg 0aa71c2
declare another event
rvelseg 169e624
tryin to get the right column number
rvelseg 4caab94
get more info
rvelseg ccab38e
using the tag id
rvelseg 8e50c96
bugfix
rvelseg c81eeee
housekeeping
rvelseg 06b09ec
option added to add column filters
rvelseg 8f6c708
housekeeping
rvelseg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
var CsvToHtmlTable = CsvToHtmlTable || {}; | ||
var CsvToHtmlTable_DataTable = {}; | ||
|
||
CsvToHtmlTable = { | ||
init: function (options) { | ||
|
@@ -8,6 +9,7 @@ CsvToHtmlTable = { | |
var allow_download = options.allow_download || false; | ||
var csv_options = options.csv_options || {}; | ||
var datatables_options = options.datatables_options || {}; | ||
var column_filters = options.column_filters || false; | ||
var custom_formatting = options.custom_formatting || []; | ||
var customTemplates = {}; | ||
$.each(custom_formatting, function (i, v) { | ||
|
@@ -29,6 +31,22 @@ CsvToHtmlTable = { | |
for (var headerIdx = 0; headerIdx < csvHeaderRow.length; headerIdx++) { | ||
$tableHeadRow.append($("<th></th>").text(csvHeaderRow[headerIdx])); | ||
} | ||
|
||
if (column_filters) { | ||
var $tableHeadRow_filter = $("<tr></tr>"); | ||
for (var headerIdx = 0; headerIdx < csvHeaderRow.length; headerIdx++) { | ||
$tableHeadRow_filter.append($("<th></th>").html( | ||
'<input type="text" id="col_f-' + headerIdx + '" placeholder="filter column" />')); | ||
$tableHeadRow_filter[0].childNodes[headerIdx].childNodes[0].onchange = function(ee) { | ||
var i = parseInt(ee.target.id.substr(6)); | ||
CsvToHtmlTable_DataTable.column(i).search(this.value).draw(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. looks like this is a new vaiable to keep track of the |
||
} | ||
$tableHeadRow_filter[0].childNodes[headerIdx].childNodes[0].onkeyup = | ||
$tableHeadRow_filter[0].childNodes[headerIdx].childNodes[0].onchange | ||
} | ||
$tableHead.append($tableHeadRow_filter); | ||
} | ||
|
||
$tableHead.append($tableHeadRow); | ||
|
||
$table.append($tableHead); | ||
|
@@ -50,7 +68,7 @@ CsvToHtmlTable = { | |
} | ||
$table.append($tableBody); | ||
|
||
$table.DataTable(datatables_options); | ||
CsvToHtmlTable_DataTable = $table.DataTable(datatables_options); | ||
|
||
if (allow_download) { | ||
$containerElement.append("<p><a class='btn btn-info' href='" + csv_path + "'><i class='glyphicon glyphicon-download'></i> Download as CSV</a></p>"); | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this code uses Bootstrap, so we should add the

form-control
andform-control-sm
classes. Currently the default styles don't resize to fit the screen width and have a different aesthetic.