diff --git a/components/select/select.ts b/components/select/select.ts index 55c36050..99541854 100755 --- a/components/select/select.ts +++ b/components/select/select.ts @@ -257,6 +257,7 @@ export class SelectComponent implements OnInit, ControlValueAccessor { @Input() public placeholder:string = ''; @Input() public idField:string = 'id'; @Input() public textField:string = 'text'; + @Input() public childrenField:string = 'children'; @Input() public multiple:boolean = false; @Input() @@ -269,8 +270,7 @@ export class SelectComponent implements OnInit, ControlValueAccessor { return item; } }); - // this.itemObjects = this._items.map((item:any) => (typeof item === 'string' ? new SelectItem(item) : new SelectItem({id: item[this.idField], text: item[this.textField]}))); - this.itemObjects = this._items.map((item:any) => new SelectItem(item)); + this.itemObjects = this._items.map((item:any) => (typeof item === 'string' ? new SelectItem(item) : new SelectItem({id: item[this.idField], text: item[this.textField], children: item[this.childrenField]}))); } }