Closed shewless closed 2 years ago
Hi @shewless , thank you for the link, that is interesting!
Well I prefer to keep itables
simple, and not add options that are not in datatables.net
.
Still I'd be interested in seeing how we could translate the multi filter example to itables
. I'm not sure we can do this at the moment (what is missing are 1. the footer cells and 2. the ability to run additional JS code), but I'll keep this in mind for later version. Is that something that would be of interest to you?
Thank you for the reply. If it's not simple to add it may not be worth it.
I think allowing to do this kind of thing in itables
is worth it... I've seen a few more cases for which we need additional JS code like here, so there is a point in doing so. I'll keep you updated (through this issue) when this becomes possible.
Thank you. I'll keep an eye on this issue.
Just to add a bit weight in favor of doing this. In R DT the column filter feature is functional and very useful.
Yes, I agree, generally speaking the DT package by RStudio is much more advanced than itables
that is a simple wrapper.
I've looked at columnFilters
and columnFilterRow
in datatables.R and they are pretty long, I don't this I could maintain a code addition that long.
Nevertheless, I do like the example quoted by @shewless (https://datatables.net/examples/api/multi_filter.html), and that one seems much more accessible, especially in itables>=1.0.0
now that we don't use require any more and that the datatables_template_connected.html
file is much simpler. The way I see a possible implementation is the following:
// pre-dt-code
between line 28 and 29 that gets replaced with custom JS code if desired
https://github.com/mwouts/itables/blob/8f6569385d652bb1ef116d817270b840a74c4873/itables/html/datatables_template_connected.html#L28-L30Can you tell me how you would like to use this? I see that the R DT package uses a filter
argument which takes values like
filter = list(
position = 'top', clear = FALSE
)
Indeed it looks like that we can do something. With the commit above I have been able to show column filters like this:
This involves much less code than in the R DT library, but I'm starting to understand why... The search box will only work as a text search, while the R DT column search box let the user search by range or values. Hopefully you're not going to ask me such advanced search boxes :smile:
The new option column_filters
is available in itables==1.1.0
and the updated documentation should soon appear at https://mwouts.github.io/itables/advanced_parameters.html
Oh sorry some files did not make it to the pip package... This should be fixed with #82 in itables==1.1.1
.
datatables has support for individual column searching: https://datatables.net/examples/api/multi_filter.html
I'm not sure if it's possible with itables currently to add the appropriate html and javascript to make this happen. It would be nice if it was an option (enable_column_search).