mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-02 03:58:07 +08:00
fix: table2 rowClassName兼容数据替换场景 (#7678)
Co-authored-by: wanglinfang <wanglinfang@baidu.com>
This commit is contained in:
parent
b2637905fa
commit
d933aeb4a0
@ -442,7 +442,7 @@ export const TableStore2 = ServiceStore.named('TableStore2')
|
||||
function exchange(fromIndex: number, toIndex: number, item?: IRow2) {
|
||||
item = item || self.rows[fromIndex];
|
||||
|
||||
if (item.parentId) {
|
||||
if (item?.parentId) {
|
||||
const parent: IRow2 = self.getRowById(item.parentId) as any;
|
||||
const offset = parent.children.indexOf(item) - fromIndex;
|
||||
toIndex += offset;
|
||||
|
@ -1591,11 +1591,13 @@ export default class Table2 extends React.Component<Table2Props, object> {
|
||||
if (rowClassNameExpr) {
|
||||
classnames.push(filter(rowClassNameExpr, {record, rowIndex}));
|
||||
}
|
||||
// row可能不存在
|
||||
// 比如初始化给了10条数据,异步接口又替换成4条
|
||||
const row = store.getRowByIndex(rowIndex);
|
||||
if (row.modified) {
|
||||
if (row?.modified) {
|
||||
classnames.push('is-modified');
|
||||
}
|
||||
if (row.moved) {
|
||||
if (row?.moved) {
|
||||
classnames.push('is-moved');
|
||||
}
|
||||
return classnames.join(' ');
|
||||
|
Loading…
Reference in New Issue
Block a user