Conversation
|
@rvelseg thanks for submitting this! Could you give an example of how you'd use this feature? |
|
@rvelseg revisiting some older PRs on this repo. This looks interesting, but could you provide an example of how you'd use this feature? |
|
You would set that to true if you wanted to search a column vs everything on the screen its actually pretty useful. |
derekeder
left a comment
There was a problem hiding this comment.
Yikes - I've sat on this PR for a long time. Sorry about that.
I think this feature is kind of neat, but we should make some changes before bringing it in.
| '<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.
looks like this is a new vaiable to keep track of the DataTable state. Is it necessary for this code to work? It seems a bit awkward to only use it for this feature. Maybe we should keep track of the DataTable this way generally?
| 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" />')); |
|
@rvelseg let me know if you want to revisit this with the feedback i've provided. I'll wait a month or so before closing this. |

Option added to use filtering on singe columns.
It is mainly based in this code
https://datatables.net/extensions/fixedheader/examples/options/columnFiltering.html
I don't normally work in javascript, I did my best to make the code work, but I don't feel it is idiomatic. So, please change whatever you consider appropriate.