angular-multi-select icon indicating copy to clipboard operation
angular-multi-select copied to clipboard

Add functionallity to accept groups without childs.

Open danicomas opened this issue 9 years ago • 4 comments

The following should work:

var u = [
    {
      name: "<strong>All Browsers</strong>",
      msGroup: true
    },
    {
      name: "<strong>Europe</strong>",
      msGroup: true,
    },
    {
      msGroup: false
    },
    {
      name: "<strong>Asia & Pacific</strong>",
      msGroup: true
    },
    {
      msGroup: false
    },
    {
      name: "<strong>Middle East</strong>",
      msGroup: true
    },
    {
      msGroup: false
    },
    {
      msGroup: false
    }];

Now only load if I have childs!

var u = [
    {
      name: "<strong>All Browsers</strong>",
      msGroup: true
    },
    {
      name: "<strong>Europe</strong>",
      msGroup: true,
    },
    { 
       icon: '<img  src="https://cdn1.iconfinder.com/data/icons/fatcow/32/opera.png" />',                         
       name: 'Only loads this hierarchy',              
       maker: 'Only loads this hierarchy',        
        ticked: false
     },
    {
      msGroup: false
    },
    {
      name: "<strong>Asia & Pacific</strong>",
      msGroup: true
    },
    {
      msGroup: false
    },
    {
      name: "<strong>Middle East</strong>",
      msGroup: true
    },
    {
      msGroup: false
    },
    {
      msGroup: false
    }];

danicomas avatar May 05 '15 11:05 danicomas

Hi @danicomas ,

Sorry for the late reply.

Actually this is not a bug, I intentionally made it to remove empty groups. But I guess you're right, it should be able to display empty groups. Will update on the next release.

isteven avatar May 22 '15 03:05 isteven

Nice @isteven

danicomas avatar May 22 '15 07:05 danicomas

Hi @isteven what is the status of this issue? would it be possible to select the group head to select all its members including the header?

elyrank avatar May 03 '17 18:05 elyrank

For those still interested: The crucial code block in isteven-angular-multiselect/isteven-multi-select.js seems to be

if (
     (
         !$scope.filteredModel[ $scope.filteredModel.length - 1 ]
         ||
         typeof $scope.filteredModel[ $scope.filteredModel.length - 1 ][ attrs.groupProperty ] !== 'undefined'
       )
       &&
       (
         !$scope.filteredModel[ $scope.filteredModel.length - 1 ]
         ||
         $scope.filteredModel[ $scope.filteredModel.length - 1 ][ attrs.groupProperty ] === false
       )
) {
  $scope.filteredModel.pop();
}
else {
  $scope.filteredModel.push( $scope.inputModel[ i ] );
    }

You might want to change it so that $scope.filteredModel.push( $scope.inputModel[ i ] ); is either always called or based on an attribute condition.

cschwaderer avatar Sep 03 '20 09:09 cschwaderer