小编Dmi*_*kov的帖子

如何从http请求将数据传递到ng2-smart-table renderComponent?

我有一个表格,单元格中有一个自定义组件,还有一个服务为我提供一些要显示的数据。我的自定义组件实现了 select。因此,表的列如下所示:

userRole: {
title: 'User Role,
type: 'custom',
renderComponent: SelectComponent,
onComponentInitFunction: (instance) => {
instance.selectEdit
.subscribe( (data) => {
console.log(data);
});
}
  },
Run Code Online (Sandbox Code Playgroud)

选择.component.html:

<select #select
        (change)="callType(select.value)"
>
  <option *ngFor="let option of options"
          attr.value="option.id" >{{option.name}}</option>
</select>
Run Code Online (Sandbox Code Playgroud)

选择.组件.ts:

export class SelectComponent implements OnInit, OnChanges, ViewCell {
@Input() value: string | number;
@Input() rowData: any;
@Input() options;
@Output() selectEdit = new EventEmitter();

constructor() {
}

ngOnInit() {
}

ngOnChanges(changes: SimpleChanges): void {

}

callType(event) {
this.selectEdit.emit(event);
}

  }
Run Code Online (Sandbox Code Playgroud)

似乎instance对象应该具有 …

ng2-smart-table angular

3
推荐指数
1
解决办法
8159
查看次数

标签 统计

angular ×1

ng2-smart-table ×1