序号增加类型,可支持数字和单字母序号

This commit is contained in:
huayj 2019-08-23 15:16:00 +08:00
parent 863ca7e905
commit 80c2ca8a8b
1 changed files with 15 additions and 1 deletions

View File

@ -682,7 +682,21 @@ class Table extends Component {
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
let isHiddenExpandIcon; let isHiddenExpandIcon;
if ( props.showRowNum ){ if ( props.showRowNum ){
data[i][props.showRowNum.key || '_index'] = i + (props.showRowNum.base || 0); switch(props.showRowNum.type){
case 'number':{
data[i][props.showRowNum.key || '_index'] = i + (props.showRowNum.base || 0);
break;
}
case 'ascii': {
data[i][props.showRowNum.key || '_index'] = String.fromCharCode(i + (props.showRowNum.base || 0).charCodeAt());
break;
}
default: {
data[i][props.showRowNum.key || '_index'] = i + (props.showRowNum.base || 0);
break;
}
}
} }
const record = data[i]; const record = data[i];
const key = this.getRowKey(record, i); const key = this.getRowKey(record, i);