Open philibe opened 6 years ago
My users don't like sliders because they don't search by range but by value, except some cases. So it's counter intuitive for them to type 2.3 ... 2.3, they would like 2.3 for example. Same thing for date.
Workaround for search number without interval for a unique number value. ( And for dates also).
$40
and it will be replaced by 40...40
fordata-type='integer'
columns (same for date
and time
)$40
and it will be replaced by 39...41
fordata-type='number'
columns.$$40
and it will be replaced by 39...41
fordata-type='number' or 'integer'
columns. HTML(
"
<script>
function search_replace_interval(event ) {
//console.log(event.data.column_type);
if(event.keyCode == 13) {
before=$(this).val();
after=before;
// prefix by the $ if you are looking for a number without interval :
//$34 will be replaced by 34...34 when type of column is integer (or date)
//$34 will be replaced by 33...35 when type of column is number (because the previous case is misplaced when number)
//$$34 will be replaced by 33...35 (to workaround the previous case when misplaced)
item=before.substring(before.lastIndexOf('$')+1);
if (before.substring(0,1)=='$') {
if (((before.substring(0,2)=='$$') || (event.data.column_type=='number'))
&& (['number', 'integer'].indexOf(event.data.column_type) >= 0) ) {
after=eval(eval(item)-1)+'...'+eval(eval(item)+1);
} else {
after=item+'...'+item;
}
//console.log(after);
}
$(this).val(after)
}
}
$(document).on('shiny:inputchanged', function(event) {
$('.datatables thead [data-type~=\"number\"] input.form-control').on('keydown',{column_type:'number'},search_replace_interval);
$('.datatables thead [data-type~=\"integer\"] input.form-control').on('keydown',{column_type:'integer'},search_replace_interval);
$('.datatables thead [data-type~=\"date\"] input.form-control').on('keydown',{column_type:'date'},search_replace_interval);
$('.datatables thead [data-type~=\"time\"] input.form-control').on('keydown',{column_type:'time'},search_replace_interval);
});
</script>
"
)
Hello,
My cases
I would like to choose the type of filter by column :)
2.3 ... 2.3
, they would like2.3
for example.':'
to force non automatic numeric filter, ie without slider, which is not a good thing for ids.TLDR :) I am aware that all I suggest take time. I would like only to not have automatic filter if it is too complicated or too long.
My workaround to not have automatic filter, for the column I want, is to cast the column to string, but I cannot do that for numeric.
Have a good day :)
My wishes :) except if it does exist but I didn't see it in rstudio/DT or datables.net
My wishes are to kept filter features but to disable automatic filter by type of variable, and to not have slider by default. Have I misread documentation or it doesn't exist ? :)
For example in my display definition, to kept
search
,filter
:but to have something like that for the filter
where type would be
auto
,no_auto
(without slider, like string filter)and by column to have something like that for the filter