Skip to content

Commit

Permalink
feat(listbox): add property selectOnInitialize to control if the list…
Browse files Browse the repository at this point in the history
… will be initialized with first item selected.
  • Loading branch information
WilliamAguera committed Aug 27, 2019
1 parent e68e142 commit a709170
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion projects/truly-ui/src/components/listbox/listbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ export class TlListBox extends ListBase implements AfterViewInit, OnDestroy, OnC

@Input() rowsPage = 10;

@Input() selectOnInitialize = true;

@Input() lazyMode = false;

@Output() clickItem: EventEmitter<any> = new EventEmitter();
Expand Down Expand Up @@ -152,7 +154,9 @@ export class TlListBox extends ListBase implements AfterViewInit, OnDestroy, OnC
}

private initializeListBox() {
this.setSelected(this.listItems.toArray()[0]);
if ( this.selectOnInitialize ) {
this.setSelected(this.listItems.toArray()[0]);
}
this.setItemsByRowSet();
this.setItemsByScroll();
this.setContainer();
Expand Down

0 comments on commit a709170

Please sign in to comment.