row id 改成随机生成

This commit is contained in:
liaoxuezhi 2019-07-04 16:05:02 +08:00
parent 7e9b36ea31
commit 9b8ec12d01
2 changed files with 8 additions and 5 deletions

View File

@ -11,7 +11,7 @@ import {
} from './iRenderer';
import isEqual = require('lodash/isEqual');
import find = require('lodash/find');
import { createObject, isObject } from "../utils/helper";
import { createObject, isObject, guid } from "../utils/helper";
import { evalExpression } from "../utils/tpl";
export const Item = types
@ -172,7 +172,8 @@ export const ListStore = iRendererStore
};
return {
id: String((item as any)[self.primaryField] || key),
// id: String((item as any)[self.primaryField] || key),
id: guid(),
index: key,
newIndex: key,
pristine: item,

View File

@ -13,7 +13,7 @@ import {
import { resolveVariable } from "../utils/tpl-builtin";
import isEqual = require('lodash/isEqual');
import find = require('lodash/find');
import { isBreakpoint, createObject, isObject, isVisible } from "../utils/helper";
import { isBreakpoint, createObject, isObject, isVisible, guid } from "../utils/helper";
import { evalExpression } from "../utils/tpl";
export const Column = types
@ -511,7 +511,8 @@ export const TableStore = iRendererStore
};
return {
id: String(item && (item as any)[self.primaryField] || `${pindex}-${depth}-${key}`),
// id: String(item && (item as any)[self.primaryField] || `${pindex}-${depth}-${key}`),
id: guid(),
key: String(`${pindex}-${depth}-${key}`),
depth: depth,
index: key,
@ -531,7 +532,8 @@ export const TableStore = iRendererStore
self.expandedRows.clear();
let arr:Array<SRow> = rows.map((item, key) => ({
id: getEntryId ? getEntryId(item, key) : String(item && (item as any)[self.primaryField] || `${key}-1-${key}`),
// id: getEntryId ? getEntryId(item, key) : String(item && (item as any)[self.primaryField] || `${key}-1-${key}`),
id: getEntryId ? getEntryId(item, key) : guid(),
key: String(`${key}-1-${key}`),
depth: 1,// 最大父节点默认为第一层,逐层叠加
index: key,