node.js - antdesign Table中的columns属性怎么和组件关联?
黄舟
黄舟 2017-04-17 15:05:00
[Node.js讨论组]
const columns = [{
  title: '申报批次',
  dataIndex: 'declareBatch',
  sorter: true,
  /*render: name => `${name.first} ${name.last}`,*/
  /*render:()=>count++,*/
  width: '18%',
}, {
  title: '被考机构',
  dataIndex: 'admittedOrganization',
  width: '19%',
}, {
  title: '申报截止日期',
  dataIndex: 'dueDate',
  width: '12%',
},{
  title: '考核时间',
  dataIndex: 'examinationDate',
   render: (msg => (
    <span>{msg[0]+'~'+msg[1]}</span>
  )),
   width: '20%',
},{
  title: '状态',
  dataIndex: 'type',
  render: msg => msg === '待确认' ? <span style={{color:"green"}}>{msg}</span> : (msg==="待提交"?<span style={{color:"orange"}}>{msg}</span>:(msg==="待审批"?<span style={{color:"red"}}>{msg}</span>:<span>{msg}</span>)),
  width: '10%',
},{
  title: '备注',
  dataIndex: 'note',
  width: '10%',
},{
  title: '操作',
  key: 'operation',
  render: (text, record) => (
    <span>
      <a>
        <Popconfirm placement="topLeft"  title={"确定要关闭该申报计划吗?"}
            onVisibleChange={this.onPopVisibleChange}
            onConfirm={this.onPopConfirm(record)}
            onCancel={this.onTableFootBatchAppointExpertClickCancel}
            visible={this.props.commonTableReduce.get('popVisible')}>
                  关闭
        </Popconfirm>
      </a>
      <span className="ant-pider"></span>
      <a><span id="check">查看</span></a>
    </span>),
  width: '12%',
  }
  ];

上面是Table中引用的clumn,最后一栏的操作里的Popconfirm的onVisibleChange等方法怎么调用下方的方法?

let AppTable = React.createClass({

  onPopConfirm(record){
    this.props.examineSubmittedTableAction.onPopConfirm(record,this.props.notificationAction,Notification)
  },
  onPopCancel(){
    this.props.examineSubmittedTableAction.onPopCancel()
  },
  onPopVisibleChange(){
    this.props.examineSubmittedTableAction.onPopVisibleChange()
  },

然后是Table的代码

<Table 
              //rowSelection={this.rowSelection}
              columns={columns}
              rowKey={record => record.id}//特别注意,需要设置表格主键唯一id的名称,以优化react显示
              dataSource={commonTableReduce.get('data').toJSON()}
              pagination={false}
              loading={commonTableReduce.get('loading')}
              onChange={this.handleTableChangePrepare}
              onRowClick= {this.onRowClick} 
              size="middle"
              ref="tableRef" 

我网站打开发现clumn里的this是undefined

那我改怎么写,或是哪里有问题?

黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

全部回复(1)
ringa_lee

把 columns 放到类里面去。

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号