yadcf icon indicating copy to clipboard operation
yadcf copied to clipboard

Being able to configure filter controls to popup in a popover, would be useful for very narrow columns

Open MrCsabaToth opened this issue 10 years ago • 10 comments

Bells and whistles enhancement: I have several narrow columns which are about 30 pixel wide only. I don't even have space for a filter clear button in their case. I saw the possibility to dedicate controls placed elsewhere on the UI for filtering. But it would be great if there could be a flag in to yadcf configuration, which would just place a button in the header (/footer wherever the filters are) and when you press that button a popover appears where you have the text input (or selection, etc) and the clear buttons.

MrCsabaToth avatar Dec 26 '14 23:12 MrCsabaToth

This could be implemented in case of bootstrap support with a bootstrap style popover. There a very slight chance I might be able work on that.

MrCsabaToth avatar Dec 27 '14 00:12 MrCsabaToth

Yeah, I thought about adding this feature, but unfortunately since the lack of time I couldn't add it yet, b.t.w IMO a better / alternative solution would be to have a small filter button (size of the sort arrow) on the left side of the header title, and when pressing on that filter icon, the header title would be replaced with the filter (input/select/etc') and pressing that filter icon again will return the header title back again.

vedmack avatar Dec 27 '14 18:12 vedmack

That would be nice feature to have in long term :+1:

dovydasvenckus avatar Mar 12 '15 19:03 dovydasvenckus

I don't think I'll have time for this unfortunately

MrCsabaToth avatar Mar 13 '15 03:03 MrCsabaToth

This would be very nice. The select2 multi-selection box is very large, with lots of columns on a page it becomes a problem.

bdunsmuir avatar Mar 27 '15 01:03 bdunsmuir

Bump. Please implement this feature. It would make this plugin perfect! :+1:

You could use <span class="halflings halflings-filter"></span> as the icon to access the popup box.

programmer24601 avatar Oct 27 '16 12:10 programmer24601

5 min of experimentation shows you can get close to this with css:


.yadcf-filter-wrapper {display:none !important}
div.yadcf-filter-wrapper.shown, th:hover  div.yadcf-filter-wrapper {
  display: block !important;
}

It just needs a bit of js adding to add/remove the shown class to the filter wrapper when the related popup menu is shown/hidden. The JS below does it, but in a super-ugly way.


$('body').on('mouseleave', '.select2-results__options', function(e){
  var x= this.id.replace('select2-','#').replace('-results','').replace('-filter-','-filter-wrapper-');
  console.log('unshowing '+x);
  $(x).removeClass('shown');
});
$('body').on('mouseenter', '.select2-results__options', function(e){
  var x= this.id.replace('select2-','#').replace('-results','').replace('-filter-','-filter-wrapper-');
  console.log('showing '+x);
  $(x).addClass('shown');
});

awesomeruss avatar Jul 02 '19 14:07 awesomeruss

@awesomeruss feel free to post a jsfiddle with your code sample

vedmack avatar Jul 04 '19 13:07 vedmack

I just used this page: https://yadcf-showcase.appspot.com/DOM_source_select2.html F12 for developer tools, add the CSS to the inspector stylesheet, and run the 2 JS commands in the console.

awesomeruss avatar Jul 04 '19 14:07 awesomeruss

@awesomeruss its nice but need more development, a PR is welcome...

vedmack avatar Jul 04 '19 15:07 vedmack