ST 表格之下拉框

html 中增加ng模板 以 st-fow命名以备绑定

let-index=“index” 是循环中的自定义变量 ,从0开始计数,正好用于取出绑定的数据和下拉框 绑定

 <st #st [data]="noticedata" [columns]="columns"   (change)="change($event)" >
            <ng-template  st-row="custom" let-item let-index="index" let-column="column">
              <nz-select disabled   nz-input [ngModel]="noticedata[index].userId" nzPlaceHolder="选择用户" name="userId" >
                <nz-option *ngFor="let data of TeacherData" nzLabel="{{data.userName}}" [nzValue]="data.userId"></nz-option>
              </nz-select>
            </ng-template>
          </st>

ts中通过render绑定

reder :自定html输入到这个列表中

  columns: STColumn[] = [
    { title: 'ID', index: 'noticeId' },
    { title: '标题', index: 'noticeTitle' },
 //   { title: '内容', index: 'noticeInfo.substr(0,100)' },
    { title: '类型', index: 'noticeType' },
    { title: '发布状态', index: 'status' },
    { title: '发布用户', index: 'userId',render:'custom' },
    {
      title: '内容',
      buttons: [
        {
      //    text: ' 点击查看',
          format: item => item.noticeInfo ? '点击查看' : '无内容',
          click: (item: any) => item.noticeInfo ? this.view(item.noticeInfo) : '',
        }],
    },
    { title: '创建时间', index: 'createTime', type: 'date' },
    {
      title: '操作',
      width: '180px',
      buttons: [
        {
          text: '编辑',
          type: 'modal',
          component: NoticeDetailComponent,
          paramName: 'i',
          //     click: item => this.router.navigateByUrl(`coursesDetail?courseId=${item.materialId}`),
          click: () => this.st.reload(),
        },
        { text: '删除', click: (item: any) => this.del(item.noticeId) },
      ],
    },
  ];

  • 数据取出并进行封装的通道方法
 this.noticedata = Array(res.data.length).fill({}).map((item: any, i: number) => {
        return {
          ID: [i + 1],
          noticeId: res.data[i].noticeId,
          noticeTitle: res.data[i].noticeTitle,
          noticeInfo: res.data[i].noticeInfo,
          noticeType: res.data[i].noticeType,
          status: res.data[i].status,
          userId: res.data[i].userId,
          projectId: res.data[i].projectId,
          createTime: res.data[i].createTime,
          updateTime: res.data[i].updateTime,
        };
      });
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值