Merge pull request #59 from RickCole21/master

Table的placeholder支持下tpl,以及修复了远程拉取数据后,不触发校验的问题
This commit is contained in:
liaoxuezhi 2019-06-03 10:04:23 +08:00 committed by GitHub
commit 719a503330
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 3 deletions

View File

@ -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>

View File

@ -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);