Skip to content

Commit

Permalink
fixed #2804
Browse files Browse the repository at this point in the history
  • Loading branch information
Mrtcndkn committed May 17, 2017
1 parent 95ee511 commit 8209c9a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 5 additions & 2 deletions components/splitbutton/splitbutton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {Router} from '@angular/router';
template: `
<div #container [ngClass]="{'ui-splitbutton ui-buttonset ui-widget':true,'ui-state-disabled':disabled}" [ngStyle]="style" [class]="styleClass">
<button #defaultbtn type="button" pButton [icon]="icon" [iconPos]="iconPos" [label]="label" cornerStyleClass="ui-corner-left" (click)="onDefaultButtonClick($event)" [disabled]="disabled" [attr.tabindex]="tabindex">
</button><button type="button" pButton class="ui-splitbutton-menubutton" icon="fa-caret-down" cornerStyleClass="ui-corner-right" (click)="onDropdownClick($event,menu,container)" [disabled]="disabled"></button>
</button><button type="button" pButton class="ui-splitbutton-menubutton" icon="fa-caret-down" cornerStyleClass="ui-corner-right" (click)="onDropdownButtonClick($event,menu,container)" [disabled]="disabled"></button>
<div #menu [ngClass]="'ui-menu ui-menu-dynamic ui-widget ui-widget-content ui-corner-all ui-helper-clearfix ui-shadow'" [style.display]="menuVisible ? 'block' : 'none'"
[ngStyle]="menuStyle" [class]="menuStyleClass">
<ul class="ui-menu-list ui-helper-reset">
Expand Down Expand Up @@ -40,6 +40,8 @@ export class SplitButton implements OnInit,OnDestroy {

@Output() onClick: EventEmitter<any> = new EventEmitter();

@Output() onDropdownClick: EventEmitter<any> = new EventEmitter();

@Input() style: any;

@Input() styleClass: string;
Expand Down Expand Up @@ -95,11 +97,12 @@ export class SplitButton implements OnInit,OnDestroy {
}
}

onDropdownClick(event: Event, menu: HTMLDivElement, container: Element) {
onDropdownButtonClick(event: Event, menu: HTMLDivElement, container: Element) {
this.menuVisible= !this.menuVisible;
this.domHandler.relativePosition(menu, container);
this.domHandler.fadeIn(menu,25);
menu.style.zIndex = String(++DomHandler.zindex);
this.onDropdownClick.emit(event);
event.stopPropagation();
}

Expand Down
5 changes: 5 additions & 0 deletions showcase/demo/splitbutton/splitbuttondemo.html
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ <h3>Events</h3>
<td>event: browser event<br></td>
<td>Callback to invoke when default command button is clicked.</td>
</tr>
<tr>
<td>onDropdownClick</td>
<td>event: browser event<br></td>
<td>Callback to invoke when dropdown button is clicked.</td>
</tr>
</tbody>
</table>
</div>
Expand Down

0 comments on commit 8209c9a

Please sign in to comment.