node.js - antdesign Table中的columns屬性怎么和組件關(guān)聯(lián)?
問(wèn)題描述
const columns = [{ title: ’申報(bào)批次’, dataIndex: ’declareBatch’, sorter: true, /*render: name => `${name.first} ${name.last}`,*/ /*render:()=>count++,*/ width: ’18%’,}, { title: ’被考機(jī)構(gòu)’, dataIndex: ’admittedOrganization’, width: ’19%’,}, { title: ’申報(bào)截止日期’, dataIndex: ’dueDate’, width: ’12%’,},{ title: ’考核時(shí)間’, dataIndex: ’examinationDate’, render: (msg => ( <span>{msg[0]+’~’+msg[1]}</span> )), width: ’20%’,},{ title: ’狀態(tài)’, dataIndex: ’type’, render: msg => msg === ’待確認(rèn)’ ? <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={'確定要關(guān)閉該申報(bào)計(jì)劃嗎?'} onVisibleChange={this.onPopVisibleChange} onConfirm={this.onPopConfirm(record)} onCancel={this.onTableFootBatchAppointExpertClickCancel} visible={this.props.commonTableReduce.get(’popVisible’)}> 關(guān)閉</Popconfirm> </a> <span className='ant-pider'></span> <a><span id='check'>查看</span></a> </span>), width: ’12%’, } ];
上面是Table中引用的clumn,最后一欄的操作里的Popconfirm的onVisibleChange等方法怎么調(diào)用下方的方法?
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}//特別注意,需要設(shè)置表格主鍵唯一id的名稱,以優(yōu)化react顯示 dataSource={commonTableReduce.get(’data’).toJSON()} pagination={false} loading={commonTableReduce.get(’loading’)} onChange={this.handleTableChangePrepare} onRowClick= {this.onRowClick} size='middle' ref='tableRef'
我網(wǎng)站打開(kāi)發(fā)現(xiàn)clumn里的this是undefined
那我改怎么寫(xiě),或是哪里有問(wèn)題?
問(wèn)題解答
回答1:把 columns 放到類里面去。
相關(guān)文章:
1. Docker for Mac 創(chuàng)建的dnsmasq容器連不上/不工作的問(wèn)題2. javascript - 求賜教:網(wǎng)易郵箱Web端模擬登錄看信的加密參數(shù)_ntes_nnid、_ntes_nuid3. javascript - 使用angular 的ui-sref 中出現(xiàn)了中文參數(shù),點(diǎn)擊跳轉(zhuǎn)后瀏覽器的地址欄里出現(xiàn)轉(zhuǎn)義后的%AE....%a%44. java - ConcurrentHashMap中的get()方法為什么可以不加鎖?5. javascript - QWebEngineView 如何爬 angular 的動(dòng)態(tài)數(shù)據(jù)?6. html5 - 這個(gè)代碼顯示功能如何實(shí)現(xiàn)?7. javascript - 用JS 七牛上傳圖片出現(xiàn)文件已存在的錯(cuò)誤(file exists)8. 工作近5年,3年Java Web ,近2年前端,未來(lái)何去何從?9. css3 - 圖片等比例縮放10. java - 字節(jié)流轉(zhuǎn)成字符串之后,在通過(guò)字符串轉(zhuǎn)成字節(jié)流后的文件為什么會(huì)不一樣?
