ui-grid icon indicating copy to clipboard operation
ui-grid copied to clipboard

Multi select dropdown UI issue

Open himsraw opened this issue 11 years ago • 39 comments

I have beent trying to create a multi select dropdown inside ui-grid. The easiest way i could find is to modify the template of 'ui-grid/dropdownEditor' that ui-grid uses. There is an option of specifying 'multiple' in

", width: '20%'"

This works but the dropdown options are not overlaying over the cell but it is hiding behind. top two options are visible but last option is hiding behind. What can i do to bring it to front. I know there should be a small fix in css. probably overflow: visible of some css class. but i could not find it. can somebody help? Double click on 'Gender' column in the plunker: http://plnkr.co/edit/ioCqCpnwpkk5A6K7dnoh?p=preview

himsraw avatar Mar 24 '15 06:03 himsraw

@himsraw You could set a max-height on your <select> which would let it scroll.

I'm not sure you have other options with a raw html element. There are lots of other angular-based multi-select widgets out there, though.

c0bra avatar Mar 24 '15 17:03 c0bra

@c0bra I was exploring other angularjs multiselect options and i came across http://ngmodules.org/modules/angularjs-dropdown-multiselect Trying to fit this into ui-grid cell but still not successful. If anyone has implemented any multiselect control inside ui-grid help would be highly appreciated.

himsraw avatar Mar 24 '15 18:03 himsraw

The issue is the cell is set to overflow: hidden. This is expected for read only cells but possibly not for edit mode? A quick fix is to simply set position: absolute on the multiselect div.

ryancampbell avatar Apr 14 '15 03:04 ryancampbell

@himsraw also would like this feature.

As you can see the dropdown doesn't work inside the filter section. Anyone know a decent workaround?

http://plnkr.co/edit/rtUZ2nY39Bu7GUQZmuDw?p=preview

bjaraujo avatar Oct 12 '15 11:10 bjaraujo

+1

arjunasuresh3 avatar Feb 02 '16 11:02 arjunasuresh3

+1

alexlukelevy avatar Mar 07 '16 16:03 alexlukelevy

@billyaraujo stuck with same problem. Did you get any solution to implement a multi select dropdown as a column filter? Thx

meenakshijha avatar Apr 29 '16 14:04 meenakshijha

@meenakshijha no. The only thing I can think of is putting the filter outside the grid but that is not the most elegant solution.

bjaraujo avatar Apr 29 '16 14:04 bjaraujo

@billyaraujo Thanks for responding. And yes outside the grid won't solve the purpose. I am trying to add , but my drop down gets hidden behind the grid header. Not sure how to view the complete options!

meenakshijha avatar Apr 29 '16 15:04 meenakshijha

+1

aplocher avatar Jun 07 '16 06:06 aplocher

Far from elegant, but here's something: http://plnkr.co/edit/MLT02DpcwoL0AK2QClow?p=preview

Just added:

.ui-grid-header-viewport { overflow:visible !important; }
.ui-grid-top-panel { overflow:visible !important; }

2016-06-07_00h16_31

aplocher avatar Jun 07 '16 07:06 aplocher

Initial question is answered here, http://plnkr.co/edit/Re7E7y38M2WpkzAJyL5p?p=preview

karthik04 avatar Jun 14 '16 14:06 karthik04

Anyone know the worked solution for multiselect filtering?

Olegarius avatar Jul 07 '16 09:07 Olegarius

+1

fabianoroberto avatar Oct 10 '16 10:10 fabianoroberto

Buy the way, if actual. I found the working solution. It's very easy :)

  1. in $scope.gridOptions.columnDefs column property adding the next
        $scope.gridOptions.columnDefs = [
          { name: 'id'},
          { name: 'name',
            width: 220,
            filterHeaderTemplate: '<div class="ui-grid-filter-container" ng-repeat="colFilter in col.filters"><filter-directive></filter-directive></div>',
          },
  1. add html file with multiselect implementation custom-grid-filter.html with controller nameCtrl
<div ng-controller = "nameCtrl">
   <multi-select
    input-model="names"
    button-label="name"
    item-label="name"
    tick-property="ticked"
    max-labels="1"
    helper-elements=""
    on-item-click="fClick( data )"
    default-label="None"
    class="level-multi-select">
  </multi-select>  
</div>
  1. add controller nameCtrl and directive filter-directive for this filter
    //custom filtering implementation
    .controller('nameCtrl',  function ($scope, $rootScope) {

     $scope.names = [
      {name: "Terry Clay", ticked:false}
     ,{name: "Marci Gill", ticked:false}
     ,{name: "Annie Orr", ticked:false}
     ];

      $scope.fClick = function(data) {
      var selectedNames = _.pluck(_.filter($scope.names, "ticked"), "name");
        if(!selectedNames.length)
          $scope.grid.appScope.gridOptions.data = $scope.grid.appScope.originalData;
        else
          $scope.grid.appScope.gridOptions.data = _.filter( $scope.grid.appScope.originalData, function (item) {
            return _.contains(selectedNames, item.name) ;
          });
      };

    })
    .directive('filterDirective', function() {
      return {
        restrict: 'E',
        templateUrl: 'custom-grid-filter.html'
      };
    })
    //end custom filtering implementation

Thats it. Buy the way, by this solution You can implement any filtering You want. Sorry, I have no time to put some example to the punker, but I hope My solution more/less understainable. Greetings from Ukraine!

Olegarius avatar Oct 10 '16 11:10 Olegarius

@c0bra do u have the fix for the multi-select ui issue?

smurugesan2016 avatar Feb 17 '17 21:02 smurugesan2016

Actually, it's not a fix. It's simple solution by adding directive to the grid template. See My decription above.

Olegarius avatar Feb 18 '17 09:02 Olegarius

@Olegarius thx for the response..Actually i am asking about the edit issue in the last row of the grid.

smurugesan2016 avatar Feb 20 '17 16:02 smurugesan2016

Sorry, not tryed. But I think it must work for edit rows to.

Olegarius avatar Feb 20 '17 17:02 Olegarius

@Olegarius Where <multi-select> directive is defined?

aruprakshit avatar Apr 13 '17 11:04 aruprakshit