Closed angelina999990 closed 1 year ago
@angelina999990 Not sure how you trigger handleToggle
, but my guess is that closeBehavor
outside
will close the dropdown when a button gets clicked for that?
I see two solutions to this:
e.stopPropagation()
to your callbacktrigger
attribute rather than show
to open the dropdown@angelina999990 Not sure how you trigger
handleToggle
, but my guess is thatcloseBehavor
outside
will close the dropdown when a button gets clicked for that?I see two solutions to this:
- Add
e.stopPropagation()
to your callback- Use the
trigger
attribute rather thanshow
to open the dropdown
@nuke-ellington handleToggle
is triggered when click a Cancel button inside dropdown, which would set isOpen
to false. And angular is supposed to detect the change of show
attribute, but it seems didn't detect it.
Because I want to programmatically control the visibility of dropdown, currently I'm using belowing solution as a workaround, which does work out.
@Component({ ... })
export class TestComponent {
// ...
@ViewChild(IxDropdown) dropdown!: IxDropdown;
handleToggle() {
if (this.dropdown) {
this.dropdown.show = false;
}
}
}
<ix-dropdown
[ixDropdownTrigger]="trigger"
closeBehavior="outside"
>
<div>
... other content
</div>
<div class="footer">
<ix-button (click)="handleToggle()">
Cancel
</ix-button>
</div>
</ix-dropdown>
Fixed in 2.0.0
What happened?
"@siemens/ix-angular": "^1.2.1", @siemens/ix: 1.3.0
ix-dropdown has a boolean property
show
. As I understand, it should open/close when variableisOpen
changes. But it doesn't change its visibiliy whenisOpen
value changes.What type of frontend frameware are you seeing the problem on?
Angular
Which version of iX do you use?
v1.3.0
Code to produce this issue.