Table表格

展示行列数据。

何时使用

  • 当有大量结构化的数据需要展现时;

  • 当需要对数据进行排序、搜索、分页、自定义操作等复杂行为时。

代码演示

Table 表格 - 图1

基本

最简单的用法。

  1. import {
  2. DataSet,
  3. Table,
  4. NumberField,
  5. DateTimePicker,
  6. SelectBox,
  7. Modal,
  8. Button,
  9. notification,
  10. } from 'choerodon-ui/pro';
  11. const { Column } = Table;
  12. function sexIdRenderer({ record }) {
  13. return record.getField('sex').getLookupData().codeValueId;
  14. }
  15. function handleUserDSLoad({ dataSet }) {
  16. const first = dataSet.get(0);
  17. if (first) {
  18. first.selectable = false;
  19. }
  20. }
  21. function renderColumnFooter(dataset, name) {
  22. const max = Math.max(
  23. 0,
  24. ...dataset.data.map(record => record.get(name)).filter(value => !isNaN(value)),
  25. );
  26. return `最大年龄:${NumberField.format(max)}`;
  27. }
  28. function renderColumnHeader(dataset, name) {
  29. const field = dataset.getField(name);
  30. return (
  31. <span>
  32. <i>-=</i>
  33. {field ? field.get('label') : ''}
  34. <i>=-</i>
  35. </span>
  36. );
  37. }
  38. const codeDynamicProps = {
  39. lovCode({ record }) {
  40. if (record) {
  41. return 'LOV_CODE';
  42. }
  43. },
  44. };
  45. const nameDynamicProps = {
  46. required({ record }) {
  47. return record.get('sex') === 'M';
  48. },
  49. };
  50. const codeCodeDynamicProps = {
  51. bind({ record }) {
  52. const field = record.getField('code');
  53. if (field) {
  54. const valueField = field.get('valueField');
  55. return `code.${valueField}`;
  56. }
  57. },
  58. };
  59. const codeDescriptionDynamicProps = {
  60. bind({ record }) {
  61. const field = record.getField('code');
  62. if (field) {
  63. const textField = field.get('textField');
  64. return `code.${textField}`;
  65. }
  66. },
  67. };
  68. class App extends React.Component {
  69. userDs = new DataSet({
  70. primaryKey: 'userid',
  71. name: 'user',
  72. autoQuery: true,
  73. pageSize: 5,
  74. transport: {
  75. read: {
  76. url: '/dataset/user/queries',
  77. },
  78. create: {
  79. url: '/dataset/user/mutations',
  80. method: 'put',
  81. },
  82. update: ({ data }) =>
  83. data.length
  84. ? {
  85. url: `/dataset/user/mutations/${data[0].userid}`,
  86. data: data[0],
  87. }
  88. : null,
  89. destroy: {
  90. url: '/dataset/user/mutations',
  91. method: 'delete',
  92. },
  93. tls({ name }) {
  94. console.log('fieldName', name);
  95. return {
  96. url: '/dataset/user/languages',
  97. };
  98. },
  99. },
  100. feedback: {
  101. loadSuccess() {
  102. notification.success({ message: 'query success!' });
  103. },
  104. },
  105. queryFields: [
  106. { name: 'name', type: 'string', label: '姓名', defaultValue: 'Hugh' },
  107. { name: 'age', type: 'number', label: '年龄' },
  108. { name: 'code', type: 'object', label: '代码描述', lovCode: 'LOV_CODE' },
  109. { name: 'sex', type: 'string', label: '性别', lookupCode: 'HR.EMPLOYEE_GENDER' },
  110. ],
  111. fields: [
  112. {
  113. name: 'userid',
  114. type: 'string',
  115. label: '编号',
  116. required: true,
  117. unique: true,
  118. help: '主键,区分用户',
  119. },
  120. {
  121. name: 'name',
  122. type: 'intl',
  123. label: '姓名',
  124. dynamicProps: nameDynamicProps,
  125. ignore: 'clean',
  126. },
  127. {
  128. name: 'age',
  129. type: 'number',
  130. label: '年龄',
  131. unique: 'uniqueGroup',
  132. max: 100,
  133. step: 1,
  134. help: '用户年龄,可以排序',
  135. },
  136. {
  137. name: 'numberMultiple',
  138. type: 'number',
  139. label: '数值多值',
  140. multiple: true,
  141. min: 10,
  142. max: 100,
  143. step: 0.5,
  144. },
  145. {
  146. name: 'code',
  147. type: 'object',
  148. label: '代码描述',
  149. dynamicProps: codeDynamicProps,
  150. transformRequest(value) {
  151. return { v: 2 };
  152. },
  153. },
  154. {
  155. name: 'code.v',
  156. type: 'number',
  157. dynamicProps: codeDynamicProps,
  158. transformRequest(value) {
  159. return 5;
  160. },
  161. },
  162. {
  163. name: 'code.d.v',
  164. type: 'number',
  165. dynamicProps: codeDynamicProps,
  166. transformRequest(value) {
  167. return 5;
  168. },
  169. },
  170. {
  171. name: 'code_code',
  172. type: 'string',
  173. label: '代码',
  174. maxLength: 20,
  175. required: true,
  176. dynamicProps: codeCodeDynamicProps,
  177. },
  178. {
  179. name: 'code_description',
  180. dynamicProps: codeDescriptionDynamicProps,
  181. type: 'string',
  182. label: '代码描述',
  183. },
  184. {
  185. name: 'code_select',
  186. type: 'string',
  187. label: '代码描述(下拉)',
  188. lovCode: 'LOV_CODE',
  189. required: true,
  190. },
  191. {
  192. name: 'codeMultiple',
  193. type: 'object',
  194. label: '代码描述(多值)',
  195. lovCode: 'LOV_CODE',
  196. multiple: true,
  197. required: true,
  198. },
  199. {
  200. name: 'codeMultiple_code',
  201. bind: 'codeMultiple.code',
  202. type: 'string',
  203. label: '代码(多值)',
  204. multiple: true,
  205. },
  206. {
  207. name: 'codeMultiple_description',
  208. bind: 'codeMultiple.description',
  209. type: 'string',
  210. label: '代码描述',
  211. multiple: ',',
  212. },
  213. {
  214. name: 'sex',
  215. type: 'string',
  216. label: '性别',
  217. lookupCode: 'HR.EMPLOYEE_GENDER',
  218. required: true,
  219. },
  220. {
  221. name: 'sexMultiple',
  222. type: 'string',
  223. label: '性别(多值)',
  224. lookupCode: 'HR.EMPLOYEE_GENDER',
  225. multiple: true,
  226. },
  227. {
  228. name: 'accountMultiple',
  229. type: 'string',
  230. bind: 'account.multiple',
  231. label: '多值拼接',
  232. lookupCode: 'HR.EMPLOYEE_GENDER',
  233. multiple: ',',
  234. },
  235. { name: 'account', type: 'object', ignore: 'always' },
  236. { name: 'enable', type: 'boolean', label: '是否开启', unique: 'uniqueGroup' },
  237. { name: 'frozen', type: 'boolean', label: '是否冻结', trueValue: 'Y', falseValue: 'N' },
  238. { name: 'date.startDate', type: 'date', label: '开始日期', defaultValue: new Date() },
  239. { name: 'date.endDate', type: 'dateTime', label: '结束日期' },
  240. ],
  241. events: {
  242. selectAll: ({ dataSet }) => console.log('select all', dataSet.selected),
  243. indexchange: ({ record }) => console.log('current user', record),
  244. submit: ({ data }) => console.log('submit data', data),
  245. load: handleUserDSLoad,
  246. query: ({ params, data }) => console.log('user query parameter', params, data),
  247. export: ({ params, data }) => console.log('user export parameter', params, data),
  248. remove: ({ records }) => console.log('removed records', records),
  249. },
  250. });
  251. copy = () => {
  252. const { userDs } = this;
  253. const { selected } = userDs;
  254. if (selected.length > 0) {
  255. userDs.unshift(...selected.map(record => record.clone()));
  256. } else {
  257. Modal.warning('请选择记录');
  258. }
  259. };
  260. insert = () => {
  261. const { userDs } = this;
  262. const { selected } = userDs;
  263. if (selected.length > 0) {
  264. userDs.splice(0, 1, ...selected);
  265. } else {
  266. Modal.warning('请选择记录');
  267. }
  268. };
  269. importData = () => {
  270. const { userDs } = this;
  271. console.log(userDs.toJSONData());
  272. console.log(userDs.toJSONData(true));
  273. console.log(userDs.toJSONData(false, true));
  274. userDs.create({ other: { enemy: [{}, {}] } });
  275. };
  276. removeAllData = () => {
  277. this.userDs.removeAll();
  278. };
  279. deleteAllData = () => {
  280. this.userDs.deleteAll();
  281. };
  282. copyButton = (
  283. <Button icon="baseline-file_copy" onClick={this.copy} key="copy">
  284. 复制
  285. </Button>
  286. );
  287. insertButton = (
  288. <Button icon="merge_type" onClick={this.insert} key="insert">
  289. 插入
  290. </Button>
  291. );
  292. importButton = (
  293. <Button icon="get_app" onClick={this.importData} key="import">
  294. 导入
  295. </Button>
  296. );
  297. removeAllButton = (
  298. <Button icon="remove_circle" onClick={this.removeAllData} key="removeAll">
  299. 全部移除
  300. </Button>
  301. );
  302. deleteAllButton = (
  303. <Button icon="delete" onClick={this.deleteAllData} key="deleteAll">
  304. 全部删除
  305. </Button>
  306. );
  307. save = () => {
  308. console.log('submit result', 'after click');
  309. };
  310. render() {
  311. const buttons = [
  312. 'add',
  313. ['save', { afterClick: this.save }],
  314. ['delete', { color: 'red' }],
  315. 'remove',
  316. 'reset',
  317. 'export',
  318. this.importButton,
  319. this.copyButton,
  320. this.insertButton,
  321. this.removeAllButton,
  322. this.deleteAllButton,
  323. ];
  324. return (
  325. <Table
  326. key="user"
  327. buttons={buttons}
  328. dataSet={this.userDs}
  329. header="User"
  330. style={{ height: 200 }}
  331. pagination={{
  332. showQuickJumper: true,
  333. }}
  334. >
  335. <Column
  336. name="userid"
  337. header={renderColumnHeader}
  338. style={{ color: 'red' }}
  339. editor
  340. width={150}
  341. lock
  342. sortable
  343. />
  344. <Column name="age" editor width={150} sortable footer={renderColumnFooter} />
  345. <Column name="enable" editor width={50} minWidth={50} lock />
  346. <Column name="name" editor width={150} sortable tooltip="always" />
  347. <Column name="code" editor width={150} sortable />
  348. <Column name="code_code" editor width={150} tooltip="overflow" />
  349. <Column name="code_select" editor width={150} />
  350. <Column name="codeMultiple" editor width={150} />
  351. <Column name="codeMultiple_code" width={150} />
  352. <Column name="sex" editor={<SelectBox />} width={150} />
  353. <Column header="性别id" renderer={sexIdRenderer} />
  354. <Column name="sexMultiple" editor width={150} />
  355. <Column name="accountMultiple" editor width={150} />
  356. <Column name="date.startDate" editor width={150} />
  357. <Column name="date.endDate" editor width={150} />
  358. <Column header="时间" name="time" editor={<DateTimePicker />} width={150} />
  359. <Column name="numberMultiple" editor width={150} minWidth={50} />
  360. <Column name="frozen" editor width={50} minWidth={50} lock="right" />
  361. </Table>
  362. );
  363. }
  364. }
  365. ReactDOM.render(<App />, mountNode);

Table 表格 - 图2

级联

级联。

  1. import {
  2. DataSet,
  3. Table,
  4. TextField,
  5. DateTimePicker,
  6. Modal,
  7. Button,
  8. Lov,
  9. Tabs,
  10. } from 'choerodon-ui/pro';
  11. const { Column } = Table;
  12. const { TabPane } = Tabs;
  13. function editorRenderer(record) {
  14. return record.status === 'add' ? <TextField /> : null;
  15. }
  16. function maleFilter(record) {
  17. return record.get('sex') === 'M' || !record.get('sex');
  18. }
  19. function femaleFilter(record) {
  20. return record.get('sex') === 'F';
  21. }
  22. class App extends React.Component {
  23. friendsDs = new DataSet({
  24. dataToJSON: 'normal',
  25. queryUrl: '/dataset/user/queries',
  26. fields: [
  27. { name: 'name', type: 'string', label: '姓名', required: true },
  28. { name: 'age', type: 'number', label: '年龄' },
  29. {
  30. name: 'sex',
  31. type: 'string',
  32. label: '性别',
  33. lookupCode: 'HR.EMPLOYEE_GENDER',
  34. required: true,
  35. },
  36. ],
  37. events: {
  38. query: ({ params, data }) => console.log('friend query parameter', params, data),
  39. },
  40. });
  41. enemyFriendsDs = new DataSet({
  42. dataToJSON: 'normal',
  43. selection: 'single',
  44. fields: [
  45. { name: 'name', type: 'string', label: '姓名', required: true },
  46. { name: 'age', type: 'number', label: '年龄' },
  47. {
  48. name: 'sex',
  49. type: 'string',
  50. label: '性别',
  51. lookupCode: 'HR.EMPLOYEE_GENDER',
  52. required: true,
  53. },
  54. { name: 'code', type: 'object', label: '代码描述', lovCode: 'LOV_CODE' },
  55. { name: 'code_code', type: 'string', bind: 'code.code' },
  56. { name: 'code_description', type: 'string', bind: 'code.description' },
  57. ],
  58. });
  59. enemyDs = new DataSet({
  60. primaryKey: 'userid',
  61. autoQuery: false,
  62. autoCreate: true,
  63. fields: [
  64. { name: 'name', type: 'intl', label: '姓名', required: true },
  65. { name: 'age', type: 'number', label: '年龄' },
  66. {
  67. name: 'sex',
  68. type: 'string',
  69. label: '性别',
  70. lookupCode: 'HR.EMPLOYEE_GENDER',
  71. required: true,
  72. },
  73. ],
  74. children: {
  75. friends: this.enemyFriendsDs,
  76. },
  77. events: {
  78. indexChange: ({ record }) =>
  79. record && console.log('enemyRecord cascadeParent', record.cascadeParent),
  80. },
  81. });
  82. userDs = new DataSet({
  83. primaryKey: 'userid',
  84. name: 'user',
  85. autoQuery: false,
  86. autoCreate: true,
  87. pageSize: 5,
  88. fields: [
  89. {
  90. name: 'userid',
  91. type: 'string',
  92. label: '编号',
  93. required: true,
  94. },
  95. {
  96. name: 'name',
  97. type: 'intl',
  98. label: '姓名',
  99. },
  100. {
  101. name: 'age',
  102. type: 'number',
  103. label: '年龄',
  104. max: 100,
  105. step: 1,
  106. },
  107. {
  108. name: 'sex',
  109. type: 'string',
  110. label: '性别',
  111. lookupCode: 'HR.EMPLOYEE_GENDER',
  112. },
  113. { name: 'enable', type: 'boolean', label: '是否开启' },
  114. ],
  115. events: {
  116. submit: ({ data }) => console.log('submit data', data),
  117. load: ({ dataSet }) => console.log('header ds', dataSet.slice()),
  118. },
  119. children: {
  120. friends: this.friendsDs,
  121. 'other.enemy': this.enemyDs,
  122. },
  123. });
  124. openModal = record => {
  125. let isCancel = false;
  126. Modal.open({
  127. drawer: true,
  128. width: 600,
  129. children: (
  130. <Tabs>
  131. <TabPane tab="Friends(M)">
  132. <Table
  133. buttons={['add', 'delete']}
  134. dataSet={this.friendsDs}
  135. rowHeight={40}
  136. filter={maleFilter}
  137. >
  138. <Column name="name" editor={editorRenderer} sortable />
  139. <Column name="age" editor sortable />
  140. <Column name="sex" editor width={150} />
  141. </Table>
  142. </TabPane>
  143. <TabPane tab="Friends(F)">
  144. <Table dataSet={this.friendsDs} rowHeight={40} filter={femaleFilter}>
  145. <Column name="name" editor={editorRenderer} sortable />
  146. <Column name="age" editor sortable />
  147. <Column name="sex" editor width={150} />
  148. </Table>
  149. </TabPane>
  150. </Tabs>
  151. ),
  152. onCancel: () => (isCancel = true),
  153. afterClose: () => record && isCancel && this.userDs.remove(record),
  154. });
  155. };
  156. createUser = () => {
  157. this.openModal(this.userDs.create({}, 0));
  158. this.friendsDs.create({});
  159. };
  160. editUser = () => {
  161. this.openModal();
  162. };
  163. toData = () => {
  164. console.log('toData', this.userDs.toData());
  165. };
  166. toJSONData = () => {
  167. console.log('toJSONData', this.userDs.toJSONData());
  168. };
  169. renderEdit = () => {
  170. return <Button funcType="flat" icon="mode_edit" onClick={this.editUser} size="small" />;
  171. };
  172. createButton = (
  173. <Button icon="playlist_add" onClick={this.createUser} key="add">
  174. 新增
  175. </Button>
  176. );
  177. toDataButton = (
  178. <Button onClick={this.toData} key="toData">
  179. toData
  180. </Button>
  181. );
  182. toJSONDataButton = (
  183. <Button onClick={this.toJSONData} key="toJSONData">
  184. toJSONData
  185. </Button>
  186. );
  187. render() {
  188. const buttons = [
  189. this.createButton,
  190. 'save',
  191. 'delete',
  192. 'query',
  193. this.toDataButton,
  194. this.toJSONDataButton,
  195. ];
  196. return [
  197. <Table key="user" buttons={buttons} dataSet={this.userDs} header="User">
  198. <Column name="userid" editor />
  199. <Column name="age" editor width={150} />
  200. <Column name="enable" editor width={50} />
  201. <Column name="name" editor width={150} />
  202. <Column header="编辑Friends" align="center" renderer={this.renderEdit} lock="right" />
  203. </Table>,
  204. <Table
  205. key="cascade1"
  206. header="Cascade Level 1"
  207. buttons={['add', 'delete']}
  208. dataSet={this.enemyDs}
  209. pagination={{ position: 'both' }}
  210. >
  211. <Column name="name" editor sortable />
  212. <Column name="age" editor sortable />
  213. <Column name="sex" editor width={150} />
  214. </Table>,
  215. <Table
  216. key="cascade2"
  217. header="Cascade Level 2"
  218. buttons={[
  219. 'add',
  220. 'delete',
  221. <Lov dataSet={this.enemyFriendsDs} name="code" mode="button" clearButton={false}>
  222. Lov
  223. </Lov>,
  224. ]}
  225. dataSet={this.enemyFriendsDs}
  226. pagination={{ position: 'top' }}
  227. >
  228. <Column name="name" editor={editorRenderer} sortable />
  229. <Column name="age" editor sortable />
  230. <Column name="code" editor width={150} />
  231. <Column name="sex" editor width={150} />
  232. </Table>,
  233. ];
  234. }
  235. }
  236. ReactDOM.render(<App />, mountNode);

Table 表格 - 图3

显示原始值

显示原始值。

  1. import {
  2. DataSet,
  3. Table,
  4. Form,
  5. TextField,
  6. NumberField,
  7. SelectBox,
  8. Modal,
  9. Button,
  10. } from 'choerodon-ui/pro';
  11. const { Column } = Table;
  12. class EditButton extends React.Component {
  13. handleClick = e => {
  14. const { record, onClick } = this.props;
  15. onClick(record, e);
  16. };
  17. render() {
  18. return <Button funcType="flat" icon="mode_edit" onClick={this.handleClick} size="small" />;
  19. }
  20. }
  21. class App extends React.Component {
  22. userDs = new DataSet({
  23. primaryKey: 'userid',
  24. name: 'user',
  25. autoQuery: true,
  26. pageSize: 5,
  27. fields: [
  28. {
  29. name: 'userid',
  30. type: 'string',
  31. label: '编号',
  32. required: true,
  33. },
  34. {
  35. name: 'name',
  36. type: 'intl',
  37. label: '姓名',
  38. },
  39. {
  40. name: 'age',
  41. type: 'number',
  42. label: '年龄',
  43. max: 100,
  44. step: 1,
  45. },
  46. {
  47. name: 'sex',
  48. type: 'string',
  49. label: '性别',
  50. lookupCode: 'HR.EMPLOYEE_GENDER',
  51. required: true,
  52. },
  53. { name: 'enable', type: 'boolean', label: '是否开启' },
  54. ],
  55. events: {
  56. submit: ({ data }) => console.log('submit data', data),
  57. },
  58. });
  59. openModal = (record, isNew) => {
  60. let isCancel = false;
  61. Modal.open({
  62. drawer: true,
  63. width: 600,
  64. children: (
  65. <Form record={record}>
  66. <TextField name="userid" />
  67. <TextField name="name" />
  68. <NumberField name="age" />
  69. <SelectBox name="sex" />
  70. </Form>
  71. ),
  72. onOk: () => this.userDs.submit(),
  73. onCancel: () => (isCancel = true),
  74. afterClose: () => isCancel && isNew && this.userDs.remove(record),
  75. });
  76. };
  77. editUser = record => {
  78. this.openModal(record);
  79. };
  80. renderEdit = ({ record }) => {
  81. return <EditButton onClick={this.editUser} record={record} />;
  82. };
  83. createUser = () => {
  84. this.openModal(this.userDs.create({}), true);
  85. };
  86. createButton = (
  87. <Button icon="playlist_add" onClick={this.createUser} key="add">
  88. 新增
  89. </Button>
  90. );
  91. render() {
  92. const buttons = [this.createButton, 'save', 'delete', 'reset'];
  93. return (
  94. <Table key="user" buttons={buttons} dataSet={this.userDs} pristine>
  95. <Column name="userid" />
  96. <Column name="age" />
  97. <Column name="enable" />
  98. <Column name="name" />
  99. <Column header="操作" align="center" renderer={this.renderEdit} lock="right" />
  100. </Table>
  101. );
  102. }
  103. }
  104. ReactDOM.render(<App />, mountNode);

Table 表格 - 图4

行内编辑

行内编辑。

  1. import { DataSet, Table, Button } from 'choerodon-ui/pro';
  2. const { Column } = Table;
  3. class App extends React.Component {
  4. ds = new DataSet({
  5. primaryKey: 'userid',
  6. name: 'user',
  7. autoQuery: true,
  8. pageSize: 5,
  9. cacheSelection: true,
  10. queryFields: [
  11. { name: 'name', type: 'string', label: '姓名' },
  12. { name: 'age', type: 'number', label: '年龄' },
  13. { name: 'code', type: 'object', label: '代码描述', lovCode: 'LOV_CODE' },
  14. { name: 'sex', type: 'string', label: '性别', lookupCode: 'HR.EMPLOYEE_GENDER' },
  15. { name: 'date.startDate', type: 'date', label: '开始日期' },
  16. {
  17. name: 'sexMultiple',
  18. type: 'string',
  19. label: '性别(多值)',
  20. lookupCode: 'HR.EMPLOYEE_GENDER',
  21. multiple: true,
  22. },
  23. ],
  24. fields: [
  25. {
  26. name: 'userid',
  27. type: 'string',
  28. label: '编号',
  29. required: true,
  30. unique: true,
  31. help: '主键,区分用户',
  32. },
  33. { name: 'name', type: 'intl', label: '姓名' },
  34. {
  35. name: 'age',
  36. type: 'number',
  37. label: '年龄',
  38. unique: 'uniqueGroup',
  39. max: 100,
  40. step: 1,
  41. help: '用户年龄,可以排序',
  42. },
  43. {
  44. name: 'numberMultiple',
  45. type: 'number',
  46. label: '数值多值',
  47. multiple: true,
  48. min: 10,
  49. max: 100,
  50. step: 0.5,
  51. },
  52. { name: 'code', type: 'object', label: '代码描述', lovCode: 'LOV_CODE' },
  53. {
  54. name: 'code_code',
  55. bind: 'code.code',
  56. type: 'string',
  57. label: '代码',
  58. maxLength: 11,
  59. required: true,
  60. },
  61. { name: 'code_description', bind: 'code.description', type: 'string', label: '代码描述' },
  62. {
  63. name: 'code_select',
  64. type: 'string',
  65. label: '代码描述(下拉)',
  66. lovCode: 'LOV_CODE',
  67. required: true,
  68. },
  69. {
  70. name: 'codeMultiple',
  71. type: 'object',
  72. label: '代码描述(多值)',
  73. lovCode: 'LOV_CODE',
  74. multiple: true,
  75. required: true,
  76. },
  77. {
  78. name: 'codeMultiple_code',
  79. bind: 'codeMultiple.code',
  80. type: 'string',
  81. label: '代码(多值)',
  82. multiple: true,
  83. },
  84. {
  85. name: 'codeMultiple_description',
  86. bind: 'codeMultiple.description',
  87. type: 'string',
  88. label: '代码描述',
  89. multiple: ',',
  90. },
  91. {
  92. name: 'sex',
  93. type: 'string',
  94. label: '性别',
  95. lookupCode: 'HR.EMPLOYEE_GENDER',
  96. required: true,
  97. },
  98. {
  99. name: 'sexMultiple',
  100. type: 'string',
  101. label: '性别(多值)',
  102. lookupCode: 'HR.EMPLOYEE_GENDER',
  103. multiple: true,
  104. },
  105. {
  106. name: 'accountMultiple',
  107. type: 'string',
  108. bind: 'account.multiple',
  109. label: '多值拼接',
  110. lookupCode: 'HR.EMPLOYEE_GENDER',
  111. multiple: ',',
  112. },
  113. { name: 'account', type: 'object' },
  114. { name: 'enable', type: 'boolean', label: '是否开启', unique: 'uniqueGroup' },
  115. { name: 'frozen', type: 'boolean', label: '是否冻结', trueValue: 'Y', falseValue: 'N' },
  116. { name: 'date.startDate', type: 'date', label: '开始日期', defaultValue: new Date() },
  117. { name: 'date.endDate', type: 'dateTime', label: '结束日期' },
  118. ],
  119. });
  120. buttons = [
  121. 'add',
  122. <Button key="create" funcType="flat" icon="add" onClick={() => this.ds.create()}>
  123. 自定义新增
  124. </Button>,
  125. ];
  126. commands = ({ record }) => [
  127. 'edit',
  128. ['delete', { color: 'red' }],
  129. <Button key="add" icon="add" onClick={() => console.log(this.ds.current.toData())} />,
  130. ];
  131. render() {
  132. return (
  133. <Table dataSet={this.ds} buttons={this.buttons} editMode="inline">
  134. <Column name="userid" style={{ color: 'red' }} editor width={150} lock sortable />
  135. <Column name="age" editor width={150} sortable />
  136. <Column name="enable" editor width={50} minWidth={50} lock />
  137. <Column name="name" editor width={150} sortable />
  138. <Column name="code" editor width={150} sortable />
  139. <Column name="code_code" editor width={150} />
  140. <Column name="code_select" editor width={150} />
  141. <Column name="codeMultiple" editor width={150} />
  142. <Column name="codeMultiple_code" width={150} />
  143. <Column name="sex" editor width={150} />
  144. <Column name="sexMultiple" editor width={150} />
  145. <Column name="accountMultiple" editor width={150} />
  146. <Column name="date.startDate" editor width={150} />
  147. <Column name="date.endDate" editor width={150} />
  148. <Column name="numberMultiple" editor width={150} minWidth={50} />
  149. <Column name="frozen" editor width={50} minWidth={50} lock="right" />
  150. <Column header="操作" width={150} command={this.commands} lock="right" />
  151. </Table>
  152. );
  153. }
  154. }
  155. ReactDOM.render(<App />, mountNode);

Table 表格 - 图5

树形数据

树形数据。

  1. import { DataSet, Table, Button, Icon } from 'choerodon-ui/pro';
  2. import { observer } from 'mobx-react';
  3. const { Column } = Table;
  4. function iconRenderer({ record, text }) {
  5. return [<Icon key="icon" type={record.get('icon')} />, <span key="text">{text}</span>];
  6. }
  7. function expandedRowRenderer({ record }) {
  8. return (
  9. <p>
  10. 功能代码:{record.get('functionCode')} 入口页面:{record.get('url')}
  11. </p>
  12. );
  13. }
  14. @observer
  15. class AddChildButton extends React.Component {
  16. render() {
  17. const { dataSet, ...otherProps } = this.props;
  18. const { current } = dataSet;
  19. return <Button {...otherProps} disabled={!current || !current.get('id')} />;
  20. }
  21. }
  22. class App extends React.Component {
  23. ds = new DataSet({
  24. primaryKey: 'id',
  25. queryUrl: '/tree.mock',
  26. submitUrl: '/tree.mock',
  27. autoQuery: true,
  28. parentField: 'parentId',
  29. idField: 'id',
  30. expandField: 'expand',
  31. checkField: 'ischecked',
  32. fields: [
  33. { name: 'id', type: 'number' },
  34. { name: 'text', type: 'string', label: '功能名称' },
  35. { name: 'url', type: 'string', label: '入口页面' },
  36. { name: 'expand', type: 'boolean', label: '是否展开' },
  37. { name: 'ischecked', type: 'boolean', label: '是否开启' },
  38. { name: 'score', type: 'number', order: 'asc' },
  39. { name: 'parentId', type: 'number', parentFieldName: 'id' },
  40. ],
  41. events: {
  42. indexchange: ({ current }) => console.log('current user', current),
  43. submit: ({ data }) => console.log('submit tree data', data),
  44. },
  45. });
  46. state = {
  47. expandIconColumnIndex: 0,
  48. border: true,
  49. mode: 'tree',
  50. expandedRender: false,
  51. };
  52. handleCreateChild = () => {
  53. this.ds.create({ parentId: this.ds.current.get('id') });
  54. };
  55. handleChangeExpandRender = () => this.setState({ expandedRender: !this.state.expandedRender });
  56. handleChangeExpandIconIndex = () =>
  57. this.setState({
  58. expandIconColumnIndex:
  59. this.state.expandIconColumnIndex > 2 ? 0 : this.state.expandIconColumnIndex + 1,
  60. });
  61. handleChangeBorder = () => this.setState({ border: !this.state.border });
  62. handleChangeMode = () => this.setState({ mode: this.state.mode === 'tree' ? 'list' : 'tree' });
  63. buttons = [
  64. 'add',
  65. 'save',
  66. 'delete',
  67. 'remove',
  68. 'query',
  69. 'expandAll',
  70. 'collapseAll',
  71. <AddChildButton key="add-child" dataSet={this.ds} onClick={this.handleCreateChild}>
  72. 添加子节点
  73. </AddChildButton>,
  74. <Button key="change-expand-type" onClick={this.handleChangeExpandIconIndex}>
  75. 切换展开图标索引
  76. </Button>,
  77. <Button key="change-border" onClick={this.handleChangeBorder}>
  78. 切换边框
  79. </Button>,
  80. <Button key="change-mode" onClick={this.handleChangeMode}>
  81. 切换树模式
  82. </Button>,
  83. <Button key="change-expand-render" onClick={this.handleChangeExpandRender}>
  84. 切换展开行渲染
  85. </Button>,
  86. ];
  87. render() {
  88. const { mode, expandIconColumnIndex, border, expandedRender } = this.state;
  89. return (
  90. <Table
  91. mode={mode}
  92. buttons={this.buttons}
  93. dataSet={this.ds}
  94. expandIconColumnIndex={expandIconColumnIndex}
  95. border={border}
  96. expandedRowRenderer={expandedRender && expandedRowRenderer}
  97. >
  98. <Column name="text" editor renderer={iconRenderer} width={450} />
  99. <Column name="url" editor />
  100. <Column name="ischecked" editor />
  101. <Column name="expand" editor />
  102. <Column header="权限设置" width={150} align="center" />
  103. </Table>
  104. );
  105. }
  106. }
  107. ReactDOM.render(<App />, mountNode);

Table 表格 - 图6

组合列

组合列。

  1. import { DataSet, Table } from 'choerodon-ui/pro';
  2. const { Column } = Table;
  3. class App extends React.Component {
  4. ds = new DataSet({
  5. primaryKey: 'userid',
  6. name: 'user',
  7. autoQuery: true,
  8. pageSize: 5,
  9. queryFields: [
  10. { name: 'name', type: 'string', label: '姓名' },
  11. { name: 'age', type: 'number', label: '年龄' },
  12. { name: 'code', type: 'object', label: '代码描述', lovCode: 'LOV_CODE' },
  13. { name: 'sex', type: 'string', label: '性别', lookupCode: 'HR.EMPLOYEE_GENDER' },
  14. { name: 'date.startDate', type: 'date', label: '开始日期' },
  15. {
  16. name: 'sexMultiple',
  17. type: 'string',
  18. label: '性别(多值)',
  19. lookupCode: 'HR.EMPLOYEE_GENDER',
  20. multiple: true,
  21. },
  22. ],
  23. fields: [
  24. { name: 'userid', type: 'string', label: '编号', required: true },
  25. { name: 'name', type: 'string', label: '姓名' },
  26. { name: 'age', type: 'number', label: '年龄', max: 100, step: 1 },
  27. { name: 'sex', type: 'string', label: '性别', lookupCode: 'HR.EMPLOYEE_GENDER' },
  28. { name: 'date.startDate', type: 'date', label: '开始日期', defaultValue: new Date() },
  29. {
  30. name: 'sexMultiple',
  31. type: 'string',
  32. label: '性别(多值)',
  33. lookupCode: 'HR.EMPLOYEE_GENDER',
  34. multiple: true,
  35. },
  36. ],
  37. });
  38. render() {
  39. return (
  40. <Table dataSet={this.ds}>
  41. <Column header="组合">
  42. <Column name="name" editor width={450} />
  43. <Column name="age" editor />
  44. </Column>
  45. <Column header="组合3">
  46. <Column header="组合2">
  47. <Column name="sex" editor />
  48. <Column name="date.startDate" editor />
  49. </Column>
  50. <Column name="sexMultiple" editor />
  51. </Column>
  52. </Table>
  53. );
  54. }
  55. }
  56. ReactDOM.render(<App />, mountNode);

Table 表格 - 图7

高级搜索条

高级搜索条。

  1. import { DataSet, Table, Button } from 'choerodon-ui/pro';
  2. const optionData = [{ text: '男', value: 'M' }, { text: '女', value: 'F' }];
  3. class App extends React.Component {
  4. optionDs = new DataSet({
  5. data: optionData,
  6. selection: 'single',
  7. });
  8. ds = new DataSet({
  9. primaryKey: 'userid',
  10. name: 'user',
  11. autoQuery: true,
  12. pageSize: 5,
  13. queryFields: [
  14. { name: 'name', type: 'string', label: '姓名' },
  15. { name: 'age', type: 'number', label: '年龄' },
  16. {
  17. name: 'sex.text',
  18. type: 'string',
  19. label: '性别',
  20. textField: 'text',
  21. valueField: 'value',
  22. options: this.optionDs,
  23. defaultValue: 'F',
  24. },
  25. { name: 'date.startDate', type: 'date', label: '开始日期' },
  26. {
  27. name: 'sexMultiple',
  28. type: 'string',
  29. label: '性别(多值)',
  30. lookupCode: 'HR.EMPLOYEE_GENDER',
  31. multiple: true,
  32. },
  33. ],
  34. fields: [
  35. { name: 'userid', type: 'string', label: '编号', required: true },
  36. { name: 'name', type: 'string', label: '姓名' },
  37. { name: 'age', type: 'number', label: '年龄', max: 100, step: 1 },
  38. { name: 'sex', type: 'string', label: '性别', lookupCode: 'HR.EMPLOYEE_GENDER' },
  39. { name: 'date.startDate', type: 'date', label: '开始日期', defaultValue: new Date() },
  40. {
  41. name: 'sexMultiple',
  42. type: 'string',
  43. label: '性别(多值)',
  44. lookupCode: 'HR.EMPLOYEE_GENDER',
  45. multiple: true,
  46. },
  47. ],
  48. events: {
  49. query: ({ params, data }) => console.log('advanced bar query parameter', params, data),
  50. },
  51. });
  52. get columns() {
  53. return [{ name: 'name', width: 450, editor: true }, { name: 'age', editor: true }];
  54. }
  55. render() {
  56. return (
  57. <Table
  58. buttons={['add']}
  59. dataSet={this.ds}
  60. queryBar="advancedBar"
  61. border={false}
  62. columns={this.columns}
  63. queryFieldsLimit={2}
  64. />
  65. );
  66. }
  67. }
  68. ReactDOM.render(<App />, mountNode);

Table 表格 - 图8

过滤条

过滤条。

  1. import { DataSet, Table, Button } from 'choerodon-ui/pro';
  2. const config = {
  3. primaryKey: 'userid',
  4. name: 'user',
  5. autoQuery: true,
  6. pageSize: 5,
  7. queryFields: [
  8. { name: 'name', type: 'string', label: '姓名', defaultValue: 'Hugh' },
  9. { name: 'age', type: 'number', label: '年龄' },
  10. { name: 'code', type: 'object', label: '代码描述', lovCode: 'LOV_CODE' },
  11. { name: 'sex', type: 'string', label: '性别', lookupCode: 'HR.EMPLOYEE_GENDER' },
  12. { name: 'date.startDate', type: 'date', label: '开始日期' },
  13. {
  14. name: 'sexMultiple',
  15. type: 'string',
  16. label: '性别(多值)',
  17. lookupCode: 'HR.EMPLOYEE_GENDER',
  18. multiple: true,
  19. },
  20. ],
  21. fields: [
  22. { name: 'userid', type: 'string', label: '编号', required: true },
  23. { name: 'name', type: 'string', label: '姓名' },
  24. { name: 'age', type: 'number', label: '年龄', max: 100, step: 1 },
  25. { name: 'sex', type: 'string', label: '性别', lookupCode: 'HR.EMPLOYEE_GENDER' },
  26. { name: 'date.startDate', type: 'date', label: '开始日期', defaultValue: new Date() },
  27. {
  28. name: 'sexMultiple',
  29. type: 'string',
  30. label: '性别(多值)',
  31. lookupCode: 'HR.EMPLOYEE_GENDER',
  32. multiple: true,
  33. },
  34. ],
  35. events: {
  36. query: ({ params, data }) => console.log('filterbar query parameter', params, data),
  37. },
  38. };
  39. class App extends React.Component {
  40. handleClick = () =>
  41. this.setState({ show: !this.state.show, ds: this.state.show ? this.ds2 : this.ds1 });
  42. handleSearchAge = () => {
  43. const {
  44. ds,
  45. ds: { queryDataSet },
  46. } = this;
  47. if (queryDataSet) {
  48. const { current } = queryDataSet;
  49. if (current) {
  50. current.set('age', 18);
  51. ds.query();
  52. }
  53. }
  54. };
  55. buttons = [
  56. <Button key="change" funcType="flat" onClick={this.handleClick}>
  57. 切换列显示
  58. </Button>,
  59. <Button key="age" funcType="flat" onClick={this.handleSearchAge}>
  60. 查询18
  61. </Button>,
  62. ];
  63. ds1 = new DataSet(config);
  64. ds2 = new DataSet(config);
  65. state = {
  66. show: false,
  67. ds: this.ds1,
  68. };
  69. getColumns() {
  70. return [
  71. {
  72. header: '组合',
  73. children: [{ name: 'name', width: 450, editor: true }, { name: 'age', editor: true }],
  74. },
  75. {
  76. header: '组合3',
  77. children: [
  78. {
  79. header: '组合2',
  80. children: [{ name: 'sex', editor: true }, { name: 'date.startDate', editor: true }],
  81. },
  82. { name: 'sexMultiple', editor: true },
  83. ],
  84. },
  85. this.state.show ? { header: '操作' } : null,
  86. ];
  87. }
  88. render() {
  89. return (
  90. <Table
  91. highLightRow={false}
  92. dataSet={this.state.ds}
  93. queryBar="bar"
  94. border={false}
  95. columnResizable={false}
  96. buttons={this.buttons}
  97. columns={this.getColumns()}
  98. />
  99. );
  100. }
  101. }
  102. ReactDOM.render(<App />, mountNode);

Table 表格 - 图9

自定义搜索条

自定义搜索条。

  1. import { DataSet, Table, Button, Form } from 'choerodon-ui/pro';
  2. const { FilterBar } = Table;
  3. const optionData = [{ text: '男', value: 'M' }, { text: '女', value: 'F' }];
  4. class App extends React.Component {
  5. optionDs = new DataSet({
  6. data: optionData,
  7. selection: 'single',
  8. });
  9. ds = new DataSet({
  10. primaryKey: 'userid',
  11. name: 'user',
  12. autoQuery: true,
  13. pageSize: 5,
  14. queryFields: [
  15. { name: 'name', type: 'string', label: '姓名' },
  16. { name: 'age', type: 'number', label: '年龄' },
  17. {
  18. name: 'sex.text',
  19. type: 'string',
  20. label: '性别',
  21. textField: 'text',
  22. valueField: 'value',
  23. options: this.optionDs,
  24. },
  25. { name: 'date.startDate', type: 'date', label: '开始日期' },
  26. {
  27. name: 'sexMultiple',
  28. type: 'string',
  29. label: '性别(多值)',
  30. lookupCode: 'HR.EMPLOYEE_GENDER',
  31. multiple: true,
  32. },
  33. ],
  34. fields: [
  35. { name: 'userid', type: 'string', label: '编号', required: true },
  36. { name: 'name', type: 'string', label: '姓名' },
  37. { name: 'age', type: 'number', label: '年龄', max: 100, step: 1 },
  38. { name: 'sex', type: 'string', label: '性别', lookupCode: 'HR.EMPLOYEE_GENDER' },
  39. { name: 'date.startDate', type: 'date', label: '开始日期', defaultValue: new Date() },
  40. {
  41. name: 'sexMultiple',
  42. type: 'string',
  43. label: '性别(多值)',
  44. lookupCode: 'HR.EMPLOYEE_GENDER',
  45. multiple: true,
  46. },
  47. ],
  48. events: {
  49. query: ({ params, data }) => console.log('custom bar query parameter', params, data),
  50. },
  51. });
  52. get columns() {
  53. return [{ name: 'name', width: 450, editor: true }, { name: 'age', editor: true }];
  54. }
  55. renderBar = props => {
  56. const { queryFields, queryDataSet, queryFieldsLimit, dataSet, buttons } = props;
  57. if (queryDataSet) {
  58. return (
  59. <>
  60. <Form columns={queryFieldsLimit} dataSet={queryDataSet}>
  61. {queryFields}
  62. <div newLine>
  63. <Button
  64. dataSet={null}
  65. onClick={() => {
  66. dataSet.query();
  67. }}
  68. >
  69. 查询
  70. </Button>
  71. <Button onClick={() => queryDataSet.reset()}>重置</Button>
  72. {buttons}
  73. </div>
  74. </Form>
  75. <FilterBar {...props} buttons={[]} />
  76. </>
  77. );
  78. }
  79. };
  80. render() {
  81. return (
  82. <Table
  83. buttons={['add']}
  84. dataSet={this.ds}
  85. queryBar={this.renderBar}
  86. columns={this.columns}
  87. queryFieldsLimit={3}
  88. />
  89. );
  90. }
  91. }
  92. ReactDOM.render(<App />, mountNode);

Table 表格 - 图10

自定义查询 DataSet

自定义查询 DataSet。

  1. import { DataSet, Table } from 'choerodon-ui/pro';
  2. const { Column } = Table;
  3. class App extends React.Component {
  4. qds = new DataSet({
  5. autoQuery: true,
  6. name: 'user',
  7. pageSize: 1,
  8. fields: [
  9. { name: 'name', type: 'string', label: '姓名' },
  10. { name: 'age', type: 'number', label: '年龄' },
  11. {
  12. name: 'code',
  13. type: 'object',
  14. label: '代码描述',
  15. lovCode: 'LOV_CODE',
  16. },
  17. {
  18. name: 'code_code',
  19. type: 'string',
  20. label: '代码',
  21. maxLength: 20,
  22. bind: 'code.code',
  23. ignore: 'always',
  24. },
  25. {
  26. name: 'code_description',
  27. type: 'string',
  28. label: '代码描述',
  29. bind: 'code.description',
  30. ignore: 'always',
  31. },
  32. ],
  33. });
  34. ds = new DataSet({
  35. primaryKey: 'userid',
  36. name: 'user',
  37. autoQuery: true,
  38. pageSize: 5,
  39. queryDataSet: this.qds,
  40. selection: 'single',
  41. fields: [
  42. { name: 'userid', type: 'string', label: '编号', required: true },
  43. { name: 'name', type: 'string', label: '姓名' },
  44. { name: 'age', type: 'number', label: '年龄', max: 100, step: 1 },
  45. { name: 'sex', type: 'string', label: '性别', lookupCode: 'HR.EMPLOYEE_GENDER' },
  46. { name: 'date.startDate', type: 'date', label: '开始日期', defaultValue: new Date() },
  47. {
  48. name: 'sexMultiple',
  49. type: 'string',
  50. label: '性别(多值)',
  51. lookupCode: 'HR.EMPLOYEE_GENDER',
  52. multiple: true,
  53. },
  54. ],
  55. events: {
  56. query: ({ params, data }) => console.log('customize qds query parameter', params, data),
  57. },
  58. });
  59. render() {
  60. return (
  61. <Table dataSet={this.ds}>
  62. <Column name="name" editor width={450} />
  63. <Column name="age" editor />
  64. <Column name="sex" editor />
  65. <Column name="date.startDate" editor />
  66. <Column name="sexMultiple" editor />
  67. </Table>
  68. );
  69. }
  70. }
  71. ReactDOM.render(<App />, mountNode);

API

Table

参数说明类型默认值
header表头ReactNode | (records) => ReactNode
footer表脚ReactNode | (records) => ReactNode
border是否显示边框booleantrue
selectionMode选择记录的模式, 可选值: rowbox click dblclick mousedown nonestring'rowbox'
onRow设置行属性({ dataSet, record, index, expandedRow }) => object
buttons功能按钮,内置按钮可添加 afterClick 钩子,用于执行除了默认行为外的动作,可选值:add delete remove save query reset expandAll collapseAll export 或 数组 或 自定义按钮,数组为可选值字符串+按钮配置属性对象string | [string, object] | ReactNode | object
queryFields自定义查询字段组件或默认组件属性,默认会根据 queryDataSet 中定义的 field 类型自动匹配组件ReactNode[] | object
queryFieldsLimit头部显示的查询字段的数量,超出限制的查询字段放入弹出窗口number
queryBar查询条, 可选值为钩子或者内置类型:advancedBar normal bar nonestring | ({ dataSet, queryDataSet, buttons, pagination, queryFields, queryFieldsLimit }) => ReactNode'normal'
rowHeight行高number | auto30
defaultRowExpanded默认行是否展开,当 dataSet 没有设置 expandField 时才有效booleanfalse
expandRowByClick通过点击行来展开子行booleanfalse
expandedRowRenderer展开行渲染器({ dataSet, record }) => ReactNode
expandIcon自定义展开图标({ prefixCls, expanded, expandable, needIndentSpaced, record, onExpand }) => ReactNode
expandIconColumnIndex展开图标所在列索引number
indentSize展示树形数据时,每层缩进的宽度number15
filter数据过滤, 返回值 true - 显示 false - 不显示(record) => boolean
mode表格展示的模式, tree 需要配合 dataSet 的idFieldparentField来展示,可选值: list treestring'list'
editMode表格编辑的模式,可选值: cell inlinestring'cell'
filterBarFieldNamequeryBarbar时,直接输入的过滤条件的字段名string'params'
filterBarPlaceholderqueryBarbar时输入框的占位符string
pagination分页器,参考配置项pagination,设为 false 时不展示分页object | false
highLightRow当前行高亮booleantrue
columnResizable可调整列宽booleantrue
pristine显示原始值booleanfalse
onExpand点击展开图标时触发(expanded, record) => void

更多属性请参考 DataSetComponent

Table.Column

参数说明类型默认值
name列对照的字段名string
width列宽,不推荐给所有列设置宽度,而是给某一列不设置宽度达到自动宽度的效果number
minWidth最小列宽number100
header列头ReactNode | (dataSet, name) => ReactNode
footer列脚ReactNode | (dataSet, name) => ReactNode
renderer单元格渲染回调({ value, text, name, record, dataSet }) => ReactNode
editor编辑器, 设为true时会根据 field 的 type 自动匹配编辑器。不可编辑请使用 false 值,而不是在控件上加 disabled。FormField | ((record, name) => FormField | boolean) | boolean
lock是否锁定, 可选值 false true left rightboolean| stringfalse
align文字对齐方式,可选值: left center rightstring
resizable是否可调整宽度booleantrue
sortable是否可排序booleanfalse
style列单元格内链样式object
className列单元格样式名string
headerStyle列头内链样式string
headerClassName列头样式名string
footerStyle列脚内链样式string
footerClassName列脚样式名string
help额外信息,常用于提示string
showHelp展示提示信息的方式。可选值 tooltip newLine nonestring'tooltip'
onCell设置单元格属性({ dataSet, record, column }) => object
command行操作按钮集,该值为数组 或 返回数组的钩子,内置按钮可添加 afterClick 钩子,用于执行除了默认行为外的动作,数组可选值:edit delete 或 [edit| delete , 按钮配置属性对象] 或 自定义按钮(string | [string, object] | ReactNode)[] | ({ dataSet, record }) => (string | [string, object] | ReactNode | object )[]
hidden隐藏boolean
tooltip用 Tooltip 显示单元格内容。可选值 none always overflowstring'none'

Table.FilterBar

参数说明类型默认值
paramName输入的过滤条件的字段名string'params'
placeholder输入框的占位符string'过滤表'

更多属性请参考 Table queryBar 属性的钩子参数。

Table.AdvancedQueryBar

参数说明类型默认值
queryFieldsLimit头部显示的查询字段的数量,超出限制的查询字段放入弹出窗口number1

更多属性请参考 Table queryBar 属性的钩子参数。

Table.ToolBar

参数说明类型默认值
queryFieldsLimit头部显示的查询字段的数量,超出限制的查询字段放入弹出窗口number1
pagination分页器,参考paginationPaginationComponentnull

更多属性请参考 Table queryBar 属性的钩子参数。

pagination

分页的配置项。

参数说明类型默认值
position指定分页显示的位置'top' | 'bottom' | 'both''bottom'