mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-02 03:58:07 +08:00
Table的placeholder支持下tpl,以及修复了远程拉取数据后,不触发校验的问题
This commit is contained in:
parent
144f4165cd
commit
923b06cb9d
@ -929,6 +929,8 @@ export default class Table extends React.Component<TableProps, object> {
|
||||
classnames: cx,
|
||||
classPrefix: ns,
|
||||
checkOnItemClick,
|
||||
render,
|
||||
data
|
||||
} = this.props;
|
||||
|
||||
return (
|
||||
@ -980,7 +982,12 @@ export default class Table extends React.Component<TableProps, object> {
|
||||
})
|
||||
) : (
|
||||
<tr className={cx('Table-placeholder')}>
|
||||
<td colSpan={columns.length}>{placeholder}</td>
|
||||
<td colSpan={columns.length}>
|
||||
{render('placeholder', {
|
||||
type: 'tpl',
|
||||
tpl: placeholder
|
||||
}, {data})}
|
||||
</td>
|
||||
</tr>
|
||||
)}
|
||||
</tbody>
|
||||
@ -1317,7 +1324,7 @@ export default class Table extends React.Component<TableProps, object> {
|
||||
}
|
||||
|
||||
render() {
|
||||
const {className, store, placeholder, classnames: cx} = this.props;
|
||||
const {className, store, placeholder, classnames: cx, data, render} = this.props;
|
||||
|
||||
this.renderedToolbars = []; // 用来记录哪些 toolbar 已经渲染了,已经渲染了就不重复渲染了。
|
||||
const heading = this.renderHeading();
|
||||
@ -1377,7 +1384,12 @@ export default class Table extends React.Component<TableProps, object> {
|
||||
this.renderRows(store.rows)
|
||||
) : (
|
||||
<tr className={cx('Table-placeholder')}>
|
||||
<td colSpan={store.filteredColumns.length}>{placeholder}</td>
|
||||
<td colSpan={store.filteredColumns.length}>
|
||||
{render('placeholder', {
|
||||
type: 'tpl',
|
||||
tpl: placeholder
|
||||
}, {data})}
|
||||
</td>
|
||||
</tr>
|
||||
)}
|
||||
</tbody>
|
||||
|
@ -352,6 +352,8 @@ export const FormItemStore = types
|
||||
(getRoot(self) as IRendererStore).notify('error', self.errors.join(''));
|
||||
} else {
|
||||
clearError();
|
||||
self.validated = false; // 拉完数据应该需要再校验一下
|
||||
|
||||
let options:Array<IOption> = json.data.options || json.data.items || json.data.rows || json.data || [];
|
||||
options = normalizeOptions(options as any);
|
||||
setOptions(options);
|
||||
|
Loading…
Reference in New Issue
Block a user