* fix(components): [upload] unable to delete files in removeFile (#19437) * fix(components): [upload] unable to delete files in removeFile * fix(components): [upload] remove file when fileList does not use v-model * Update packages/components/upload/src/use-handlers.ts Co-authored-by: btea <2356281422@qq.com> --------- Co-authored-by: leiyu <leiyu@cmss.chinamobile.com> Co-authored-by: btea <2356281422@qq.com> * fix(components): [page-header] use `$slots` instead of `useSlots` (#19455) * fix(components): [page-header] use `$slots` instead of `useSlots` closed #19453 * test(components): [page-header] add classes slots rendering case * fix(components): [select] input width fills the remaining width (#19292) * fix(components): [select] input width fills the remaining width closed #17886 * fix: type * feat(components): [select, select-v2] add loading class to validateIcon (#19379) fix(components): [select, select-v2] add loading class to validateIcon * chore: update doc (#19479) * perf(components): [table] prioritize use rowKey to determine whether it is selected (#19451) * perf(components): [table] use rowKey to determine whether it is selected * chore: revert includes * perf: use includes replace isEqual * feat(components): [table] add allow-drag-last-column prop (#19374) * chore: Update changelog 2.9.2 (#19491) chore: update changelog 2.9.2 * chore: format dropdown docs (#19495) * fix(components): [description] `labelWidth` is invalid when no border (#19162) * fix(components): [description] `labelWidth` is invalid when no border * test: add test case * fix(hooks): [use-lockscreen] remove hiddenCls (#19429) * fix(hooks): [use-lockscreen] remove hiddenCls * fix(hooks): [useLockscreen] unit test * test(hooks): [useLockscreen] should not cleanup when not all unmounted * test(hooks): [useLockscreen] update test * test(hooks): [useLockscreen] update test * feat(components): [dialog/drawer] add custom sub classes (#19099) * feat(components): [dialog/drawer] add custom sub classes * docs(components): add custom classes for drawer/dialog slots * docs(components): [dialog/drawer] keep same description * test: add dialog/drawer sub classes * refactor: sync typo docs with props * chore: change release version * chore: rename * chore: fix doc --------- Co-authored-by: btea <2356281422@qq.com> * chore: upgrade puppeteer to 23.11.1 (#19500) * ci: update test-ssr.yml (#19521) * fix(components): [form] on post rules update reset field (#19129) * fix(components): [form] track rules on post update closed #19109 * fix(components): [form] ensure reset field state if no rules closed #19128 * test: add validate on rule change case * chore: on rules update reset field error * chore: fixup --------- Co-authored-by: btea <2356281422@qq.com> * fix(components): [tabs] set modelValue synchronously if beforeLeave is not set or is synchronous (#19387) * fix: [tabs] sync modelValue if beforeLeave is not set or is synchronous * feat: add unit test * feat(i18n): add Hindi language (#19483) * feat(i18n): add Hindi language * feat(i18n): update component and hindi translations * feat(i18n): update lint * docs: [collapse] change event parameter type error (#19539) * chore: fix handleChange type error * Update docs/examples/collapse/custom-icon.vue Co-authored-by: Noblet Ouways <91417411+Dsaquel@users.noreply.github.com> --------- Co-authored-by: Noblet Ouways <91417411+Dsaquel@users.noreply.github.com> * fix(components): [select] make sure the e-tag is not obstructed(#19529) (#19534) Co-authored-by: baiwusanyu-c <chenzhihui@chabaidao.com> * ci: run pkg.new when push (#19544) * docs: [button] add description (#19536) * ci: stop run pkg.new when push (#19545) * improvement(components): [text] add the title attribute (#19496) * improvement(components): [text] keep the inherited title attribute (#19551) * improvement(components): [text] keep the inherited title attribute * fix: content update recalculation * fix(components): [dialog] fix scroll bar not resetting to top on reopen (#19471) * fix(components): [dialog] Fix scroll bar not resetting to top on reopen closed #19420 * fix(components): update * fix(components): [dialog] update --------- Co-authored-by: Noblet Ouways <91417411+Dsaquel@users.noreply.github.com> * test: [table] add show-overflow-tooltip trigger (#19556) * test: [table] add show-overflow-tooltip trigger * test: [table] add show-overflow-tooltip trigger * feat(i18n): add Norsk(no) language (#19523) * chore: update doc ui (#19586) * style(components): [dialog] no rounded when in fullscreen (#19583) * feat(component): [time-select] add include end time attribute (#19253) * feat: [time-select] init includeEndTime 🚧 * test: time-select includeEndTime 🚧 * refactor: renaming & cleanup * test(components): [time-select] add includeEndTime cases ✅ * docs(components): [time-select] add `includeEndTime` attribute * chore: change release version * chore: set `includeEndTime` default to false * docs: fix props typo * chore: remove useless assignment * chore: rename optionValue to currentTime * chore: update release version * Revert "ci: update test-ssr.yml" (#19610) Revert "ci: update test-ssr.yml (#19521)" This reverts commiteab540a3f7. * chore: Update changelog 2.9.3 (#19611) chore: update changelog 2.9.3 * chore: [time-picker] correct typo in `timePickerRangeTriggerProps` (#19487) * fix: correct typo in timePickerRangeTriggerProps * chore: deprecate misspelled export `timePickerRngeTriggerProps` --------- Co-authored-by: btea <2356281422@qq.com> * chore(docs): implement dynamic links for playground based on preview state (#19612) * docs: [calendar] add exposes (#19593) * docs: [calendar] add exposes * Apply suggestions from code review add translation characters Co-authored-by: btea <2356281422@qq.com> * docs: [calendar] format the exposes table --------- Co-authored-by: btea <2356281422@qq.com> * feat(components): [image-viewer] add showPreview method (#19466) * feat(components): [image-viewer] add showPreview method * docs(components): [image] update showPreview method version to 2.9.4 * chore: enable fileNesting config (#19615) * docs(components): [table-v2] add `indent-size` (#19621) docs(components): [table-v2] add `indent-size` Co-authored-by: gongbei <gongbei@wps.cn> * chore: [message-box] remove @ts-nocheck directive (#19277) * chore: [message-box] remove @ts-nocheck directive * fix: type * Update packages/components/message-box/src/index.vue Co-authored-by: qiang <qw13131wang@gmail.com> --------- Co-authored-by: qiang <qw13131wang@gmail.com> * feat(locale): add language Chinese Hongkong and Chinese Macau (#19608) * feat(components): [select] add popup-scroll event (#19589) * feat(components): [select] add popup-scroll event * Update docs/en-US/component/select.md Co-authored-by: btea <2356281422@qq.com> * chore: format --------- Co-authored-by: btea <2356281422@qq.com> Co-authored-by: warmthsea <2586244885@qq.com> * docs: add code file-title and icon (#19638) * docs: add code file-title and icon * chore: update deps * docs: add lang records (#19650) * chore: [tree] remove unused arg (#19255) * feat(i18n): add Telugu language (#19624) * feat(i18n): add Telugu language * chore(i18n): added missing keys in Telugu locale * chore: format telugu locale file. * chore(locale): fix lint in te.ts * docs: add lang records * feat(components): [image-viewer] add `progress` slot and `show-progress` props (#19465) * refactor(components): simplify computed properties in image-viewer * feat(components): [image-viewer] add progress number * test(components): remove console logs from image-viewer tests * feat(components): [image-viewer] update progress display and style * test(components): update progress selector in image-viewer tests * feat(components): [image-viewer] add slot support for progress display * docs(components): [image] add progress content description * docs(components): update docs * feat(components): [image] simplify progress slot binding * docs(components): update * Update packages/components/image-viewer/__tests__/image-viewer.test.tsx Co-authored-by: btea <2356281422@qq.com> * Update docs/en-US/component/image.md Co-authored-by: btea <2356281422@qq.com> * docs: update progress version in image documentation * Update packages/components/image-viewer/src/image-viewer.vue Co-authored-by: sea <45450994+warmthsea@users.noreply.github.com> * feat: add showProgress props * docs: add demo * docs: update v * Update docs/en-US/component/image.md Co-authored-by: btea <2356281422@qq.com> --------- Co-authored-by: btea <2356281422@qq.com> Co-authored-by: sea <45450994+warmthsea@users.noreply.github.com> * fix(components): [table-footer] update cols width on layout change (#19064) fix(components): [table-footer] update cols width on layout change closed #19054 Co-authored-by: sea <45450994+warmthsea@users.noreply.github.com> * fix(ci): types & dark theme sync with pr (#19668) ci: set whole pr bundle * fix(ci): move all bundle to docs dist (#19671) * docs: format table-v2 & use actions/upload-artifact v4 (#19670) * docs: format table-v2 * chore: update actions/upload-artifact * chore: update * chore: update * feat(components): [image-viewer] add toolbar slot (#19497) * feat(components): [image-viewer] add toolbar slot * feat(docs): add docs * docs: update * docs: update * docs: update image viewer API types for clarity * docs: update custom toolbar version in image documentation to 2.9.4 * Update docs/examples/image/custom-toolbar.vue Co-authored-by: sea <45450994+warmthsea@users.noreply.github.com> * style: remove dividers * revert: style * docs: format --------- Co-authored-by: sea <45450994+warmthsea@users.noreply.github.com> * docs: [menu] `left-and-right` example style tag add scoped (#19654) Update left-and-right.vue 防止文档演示项目整页元素布局样式被修改 Co-authored-by: btea <2356281422@qq.com> * docs: [tree-v2] fix style error and remove annotation (#19681) * docs: [transfer] fix type error (#19682) * feat(components): [cascader] add `prefix` slot (#19631) * feat(components): [cascader] add prefix slot * docs(components): [cascader] add preview slot * Revert "docs(components): [cascader] add preview slot" This reverts commit1a40ca13ea. * docs(components): [cascader] revert for typo * fix(components): do not render prefix if prefix slot is not used * docs(components): [cascader] prefix version number added Co-authored-by: btea <2356281422@qq.com> * docs(components): [cascader] format docs --------- Co-authored-by: btea <2356281422@qq.com> * fix(components): [table] selection-change event emit incorrectly (#19618) * feat(components): [table] fix 'selection-change' event emit incorrectly * fix(components): [table] add test case * docs: [timeline] fix type error (#19688) * docs: [timeline] fix type error * Update docs/examples/timeline/custom-node.vue Co-authored-by: sea <45450994+warmthsea@users.noreply.github.com> * Update docs/examples/timeline/custom-node.vue Co-authored-by: sea <45450994+warmthsea@users.noreply.github.com> --------- Co-authored-by: sea <45450994+warmthsea@users.noreply.github.com> * docs: [dropdown] add `button-props` prop (#19694) docs: [dropdown] add `button-props` prop Co-authored-by: Bruce Lu <smallbone.lu@gmail.com> * docs: [tabs] fix type error (#19690) * docs: [switch] fix type error (#19704) * fix(components): [table] The index parameter of the selectable function is undefined (#19587) * fix(components): [table] first record can not be checked * fix(components): [table] last commit doesnt work for others index Co-authored-by: Noblet Ouways <91417411+Dsaquel@users.noreply.github.com> * test(components): [table] add test cases * test(components): [table] modify the test case of the last submission --------- Co-authored-by: Noblet Ouways <91417411+Dsaquel@users.noreply.github.com> Co-authored-by: btea <2356281422@qq.com> * fix(components): [autocomplete] prevent closing if focus is inside popper content (#19522) fix: [autocomplete] prevent closing if focus is inside popper content * docs: [layout] add a tip for layout column (#19669) docs: layout add tip * docs: [checkbox] fix intermediate example type error (#19713) docs: [checkbox] fix type error * docs: [input-number] fix type error (#19712) * docs: fix Exposes error (#19733) * feat(components): [table] add tooltip-formatter table & table-column prop (#19524) * feat(components): [table] add `tooltip-formatter` table-column prop closed #19507 * docs: add example * docs: demo remove tooltip formatter index * refactor(components): refactor code * docs: simpify tooltip demo * fix: fix warning error * feat(components): add table tooltip-formatter prop & merge slot * refactor: reuse variables * test: add tooltip-formatter test * docs: upgrade version * feat(components): [table] add `tooltip-formatter` table-column prop closed #19507 * docs: add example * docs: demo remove tooltip formatter index * refactor(components): refactor code * docs: simpify tooltip demo * fix: fix warning error * feat(components): add table tooltip-formatter prop & merge slot * refactor: reuse variables * test: add tooltip-formatter test * docs: upgrade version * refactor: change parameter to obj args * fix: property change to prop * fix: export `TableOverflowTooltipFormatterData` * refactor: `TableOverflowTooltipFormatterData` to `TableTooltipData` * fix: remove useless import * fix: refactor code --------- Co-authored-by: btea <2356281422@qq.com> * docs: search input default focus (#19724) * docs: search input default focus * fix(docs): ensure search input is focused after component mounts * revert: update * Update docs/.vitepress/vitepress/components/globals/overview.vue Co-authored-by: qiang <qw13131wang@gmail.com> * Update docs/.vitepress/vitepress/components/globals/overview.vue Co-authored-by: qiang <qw13131wang@gmail.com> * docs: update --------- Co-authored-by: qiang <qw13131wang@gmail.com> * fix(components): [input] refused to apply inline style because it violates csp (#19541) fix(components): [input] CSP support #15065 `element.setAttribute('style', 'css code')` violate Content Security Policy (CSP) using `element.style.setProperty()` instead * docs: [tooltip] fix type error (#19687) * docs: fix type error * docs: [tooltip] remove unnecessary width and height in mousemove handler * fix: update * fix: update * fix(components): [table-v2] make the fixed columns scroll like mainTable (#19104) fix(components): [table-v2] Make the fixed columns scroll like mainTable Make the fixed columns behave like the mainTable, where the rows containing fixedData stick in place, and the rest of the rows scroll. closed #19103 * fix(components): [cascader-panel] lazy return children can't get value (#19100) * fix(components): [cascader-panel] lazy return children can't get value fix #9157 closed #9157 * fix: update * fix(components): [table] fix the logic of `selection` column when `fixed` state changes dynamically (#19703) * fix(components): [table] selection column fixed left * fix(components): [table] optimize function * fix(components): [table] add dynamic columns test case * fix(components): [table] the toggleTreeExpansion failed to trigger load function (#18728) * feat(components): [table] fix lazy loading * Modify the function usage * chore: format `dropdown.md` (#19758) chore: format dropdown.md * feat(locale): export zhHk/zhMo (#19762) * docs: [calendar] add CalendarDateType Type Declarations (#19766) docs: [calendar] add Type Declarations * chore: update doc (#19770) * fix(components): [table-v2] reset `lastVisitedColumnIdx` if width change (#19757) fix(components): [table-v2] reset lastVisitedColumnIdx if width change * ci: fix corepack matching keyid error (#19783) * docs: [scrollbar] fix type error (#19697) * docs: [scrollbar] fix type error * refactor(docs): improve code structure and type annotations in examples * Update docs/examples/scrollbar/manual-scroll.vue Co-authored-by: btea <2356281422@qq.com> * fix(docs): replace lodash isNumber with typeof check * fix(docs): update --------- Co-authored-by: btea <2356281422@qq.com> * chore(components): [cascader-node] remove ts-nocheck and fix type error (#19776) * chore(components): [CascaderNode] remove ts-nocheck and fix type error * chore: format --------- Co-authored-by: warmthsea <2586244885@qq.com> * feat(locale): export Norsk(no) (#19747) feat(locale): export Norsk(no) Added Norwegian language reference Co-authored-by: btea <2356281422@qq.com> * feat(locale): export missing language (#19790) feat(locale): export missing locale * chore: Update changelog 2.9.4 (#19792) chore: update changelog 2.9.4 * docs: optimization API style (#19793) * docs: optimization API style * chore: Transfer * chore: update * fix: update * chore(components): [tree] remove ts-nocheck and fix type error (#19777) * chore(components): [tree] remove ts-nocheck and fix type error * refactor: refactor --------- Co-authored-by: btea <2356281422@qq.com> * chore: update doc (#19831) * fix(components): [message-box] init validator (#19832) * fix(components): [message-box] init validator * fix: update --------- Co-authored-by: xingyixiang <452282988@qq.com> * docs: [message-box] update options default value (#19833) * refactor(components): [menu] change to `script setup` writing and optimizing code (#19816) * refactor(components): [menu] refactor * Update packages/components/menu/src/menu-collapse-transition.vue * refactor(components): migrate ElMenuItem to Composition API * fix: update * chore: chore * refactor: refactor * revert: revert * refactor: refactor * revert: revert * fix: Expose * Update packages/components/menu/src/menu-item.vue Co-authored-by: sea <45450994+warmthsea@users.noreply.github.com> --------- Co-authored-by: sea <45450994+warmthsea@users.noreply.github.com> * refactor: [menu] add necessary braces (#19840) * fix(components): [tree-select] dynamic bind class invalid (#19803) * test: [tree-select] dynamic class case (#19859) * chore: change create issue use (#19865) * feat(components): [dropdown] add `persistent` prop (#19797) * feat(components): add persistent attribute * Update docs/en-US/component/dropdown.md Co-authored-by: btea <2356281422@qq.com> * fix: docs --------- Co-authored-by: btea <2356281422@qq.com> * fix(components): [table] compatible with window non-existence (#19837) ElTable's doLayout method is debounced and scheduled (relying on setTimeout) which causes problems in testing(Vitest). Sometimes the testing environment(jsdom) is destroyed before doLayout() executes which causes error due to requestAnimationFrame not existing. To mitigate this issue can check if the window exists which is a good indication that jsdom has not been thorn down yet. * feat(components): [menu] add `persistent` prop (#19874) feat(components): [menu] add persistent prop * refactor: [time-picker] optimize type declaration (#19875) chore: [time-picker] optimize type declaration * fix(components): [select] solve memory leak (#19709) fix(components): solve memory leak Watching the value of an attribute of an option can lead to a memory leak closed #19680 Co-authored-by: 张东 <A80784@internet.com> * chore: [tree] export types (#19846) * chore: [tree] export type and fix the type error of the docs * revert: revert * revert: revert * feat(components): [cascader] add suggestion slot (#19866) * feat(components): [cascader] add suggestion-item slot * docs: add version to suggestion item slot demo Co-authored-by: btea <2356281422@qq.com> * Update docs/en-US/component/cascader.md --------- Co-authored-by: btea <2356281422@qq.com> * fix(components): [steps] update border-color to support safari (#19726) * fix(components): [description] tsx rendering functional component error (#19879) * fix(components): [description] tsx render * fix: update * fix: update * test: add test case * fix(components): [cascader] prevent default behavior when pressing a key to toggle suggestion list (#19897) fix(components): [cascader] suggestion key-down scroll warn * feat(components): [message-box] support custom close icon in message-box (#18168) * fix(components): [message-box] vue warning when closeIcon is component (#19901) * docs: [button] update default value and description (#19903) * fix(components): [select] ensure scrollbar syncs when scrolling to selected option (#19636) * fix: ensure scrollbar syncs when scrolling to selected option * feat: update scrollbar when drop-down menu is displayed * fix(components): [tree-select] search solve memory leak (#19895) * fix(components): [tree-select] search solve memory leak * feat: update * fix: test * chore: update test * feat(components): [slider] add `persistent` prop (#19889) * feat(components): [Slider] add persistent prop * fix(components): [slider] update persistent prop * fix(components): [slider] rename persistent prop to tooltipPersistent * Update docs/en-US/component/slider.md Co-authored-by: btea <2356281422@qq.com> * chore: formatted * fix(components): [slider] update description for persistent prop --------- Co-authored-by: btea <2356281422@qq.com> * docs(components): [dropdown] update description and example (#19908) docs(components): [dropdown]update description and example * docs(components): [tree] change `customized-node` example (#19907) * test: other branch commit pr.new * ci: update --------- Co-authored-by: ly-yewu <leiyu_yewu@cmss.chinamobile.com> Co-authored-by: leiyu <leiyu@cmss.chinamobile.com> Co-authored-by: btea <2356281422@qq.com> Co-authored-by: Noblet Ouways <91417411+Dsaquel@users.noreply.github.com> Co-authored-by: qiang <qw13131wang@gmail.com> Co-authored-by: Lo <l709937065@gmail.com> Co-authored-by: 0song <82012629+0song@users.noreply.github.com> Co-authored-by: Element <wallement@gmail.com> Co-authored-by: Liao-js <43257608+Liao-js@users.noreply.github.com> Co-authored-by: DDDDD12138 <43703884+DDDDD12138@users.noreply.github.com> Co-authored-by: steveWang13 <107922326+steveWang13@users.noreply.github.com> Co-authored-by: jiaxiang <zj.x9872@foxmail.com> Co-authored-by: 白雾三语 <32354856+baiwusanyu-c@users.noreply.github.com> Co-authored-by: baiwusanyu-c <chenzhihui@chabaidao.com> Co-authored-by: 晚风予星 <75473409+lxKylin@users.noreply.github.com> Co-authored-by: Meet you <wjp_github@163.com> Co-authored-by: xingyixiang <452282988@qq.com> Co-authored-by: changehu <814394170@qq.com> Co-authored-by: iamkun <kunhello@outlook.com> Co-authored-by: betavs <34408516+betavs@users.noreply.github.com> Co-authored-by: LAMMU <38106851+LAMMUpro@users.noreply.github.com> Co-authored-by: jiaxiang <zjx9987@gmail.com> Co-authored-by: baclona <853940223@qq.com> Co-authored-by: gongbei <gongbei@wps.cn> Co-authored-by: Mark J <markpro.code@gmail.com> Co-authored-by: Mouli Bheemaneti <57999522+moulibheemaneti@users.noreply.github.com> Co-authored-by: Jiankian <i@anline.cn> Co-authored-by: David Kitano <63226115+DavidKitano@users.noreply.github.com> Co-authored-by: Nick Wu <38874640+wNing50@users.noreply.github.com> Co-authored-by: smallbone <lue2048@163.com> Co-authored-by: Bruce Lu <smallbone.lu@gmail.com> Co-authored-by: 伊墨 <1905672206@qq.com> Co-authored-by: 知晓同丶 <zhixiaotong.me@qq.com> Co-authored-by: hanchao-c0ldwave <hanchao@cmss.chinamobile.com> Co-authored-by: coderchang <coderchang0105@gmail.com> Co-authored-by: pengpeng <30883395+webvs2@users.noreply.github.com> Co-authored-by: Delyan Haralanov <purepear@gmail.com> Co-authored-by: 锌小子 <2252647301@qq.com> Co-authored-by: 张东 <A80784@internet.com> Co-authored-by: DiamondYuan <541832074@qq.com> Co-authored-by: xion <65892539+xionkq@users.noreply.github.com> Co-authored-by: zhuft-moon <zhufengting_yewu@cmss.chinamobile.com> Co-authored-by: dengguangmiaoyyds <gujiao_yewu@cmss.chinamobile.com>
61 KiB
title, lang
| title | lang |
|---|---|
| Table | en-US |
Table
Display multiple data with similar format. You can sort, filter, compare your data in a table.
Basic table
Basic table is just for data display.
:::demo After setting attribute data of el-table with an object array, you can use prop (corresponding to a key of the object in data array) in el-table-column to insert data to table columns, and set the attribute label to define the column name. You can also use the attribute width to define the width of columns.
table/basic
:::
Striped Table
Striped table makes it easier to distinguish different rows.
:::demo Attribute stripe accepts a Boolean. If true, table will be striped.
table/striped
:::
Table with border
:::demo By default, Table has no vertical border. If you need it, you can set attribute border to true.
table/with-border
:::
Table with status
You can highlight your table content to distinguish between "success, information, warning, danger" and other states.
:::demo Use row-class-name in el-table to add custom classes to a certain row. Then you can style it with custom classes.
table/with-status
:::
Table with show overflow tooltip
When the content is too long, it will break into multiple lines, you can use show-overflow-tooltip to keep it in one line.
:::demo Attribute show-overflow-tooltip, which accepts a Boolean value. When set true, the extra content will show in tooltip when hover on the cell.
table/show-overflow-tooltip
:::
Table with fixed header
When there are too many rows, you can use a fixed header.
:::demo By setting the attribute height of el-table, you can fix the table header without any other codes.
table/fixed-header
:::
Table with fixed column
When there are too many columns, you can fix some of them.
:::demo Attribute fixed is used in el-table-column, it accepts a Boolean. If true, the column will be fixed at left. It also accepts two string literals: 'left' and 'right', both indicating that the column will be fixed at corresponding direction.
table/fixed-column
:::
Table with fixed columns and header
When you have huge chunks of data to put in a table, you can fix the header and columns at the same time.
:::demo Fix columns and header at the same time by combining the above two examples.
table/fixed-column-and-header
:::
Fluid-height Table with fixed header (and columns)
When the the data is dynamically changed, you might want the table to have a maximum height rather than a fixed height and to show the scroll bar if needed.
:::demo By setting the attribute max-height of el-table, you can fix the table header. The table body scrolls only if the height of the rows exceeds the max height value.
table/fixed-header-with-fluid-header
:::
Grouping table head
When the data structure is complex, you can use group header to show the data hierarchy.
:::demo Only need to place el-table-column inside a el-table-column, you can achieve group header.
table/grouping-header
:::
Table with fixed group header
fixed group head is supported
:::demo The attribute fixed of the group header is determined by the outermost el-table-column
table/fixed-column-and-group-header
:::
Single select
Single row selection is supported.
:::demo Table supports single row selection. You can activate it by adding the highlight-current-row attribute. An event called current-change will be triggered when row selection changes, and its parameters are the rows after and before this change: currentRow and oldCurrentRow. If you need to display row index, you can add a new el-table-column with its type attribute assigned to index, and you will see the index starting from 1.
table/single-select
:::
Multiple select
You can also select multiple rows.
After ^(2.8.3), toggleRowSelection supports the third parameter ignoreSelectable to determine whether to ignore the selectable attribute.
:::demo Activating multiple selection is easy: simply add an el-table-column with its type set to selection.
table/multi-select
:::
Sorting
Sort the data to find or compare data quickly.
:::demo Set attribute sortable in a certain column to sort the data based on this column. It accepts Boolean with a default value false. Set table attribute default-sort to determine default sort column and order. To apply your own sorting rules, use sort-method or sort-by. If you need remote sorting from backend, set sortable to custom, and listen to the sort-change event on Table. In the event handler, you have access to the sorting column and sorting order so that you can fetch sorted table data from API. In this example we use another attribute named formatter to format the value of certain columns. It accepts a function which has two parameters: row and column. You can handle it according to your own needs.
table/sort
:::
Filter
Filter the table to find desired data.
:::demo Set attribute filters and filter-method in el-table-column makes this column filterable. filters is an array, and filter-method is a function deciding which rows are displayed. It has three parameters: value, row and column.
table/filter
:::
Custom column template
Customize table column so it can be integrated with other components.
:::demo You have access to the following data: row, column, $index and store (state management of Table) by slot.
table/custom-column
:::
Table with custom header
Customize table header so it can be even more customized.
:::demo You can customize how the header looks by header slots.
table/custom-header
:::
Expandable row
When the row content is too long and you do not want to display the horizontal scroll bar, you can use the expandable row feature.
:::demo Activate expandable row by adding type="expand" and slot. The template for el-table-column will be rendered as the contents of the expanded row, and you can access the same attributes as when you are using slot in custom column templates.
table/expandable-row
:::
Tree data and lazy mode
:::demo You can display tree structure data. When row contains the children field, it is treated as nested data. For rendering nested data, the prop row-key is required. Also, child row data can be loaded asynchronously. Set lazy property of Table to true and the function load. Specify hasChildren attribute in row to determine which row contains children. Both children and hasChildren can be configured via tree-props.
table/tree-and-lazy
:::
Selectable tree ^(2.8.0)
:::demo When treeProps.checkStrictly is true, the selection state of parent and child nodes is no longer associated, that is, when the parent node is selected, its child nodes will not be selected; when treeProps.checkStrictly is false, the selection state of parent and child nodes will be associated with the selection state of child nodes, that is, when the parent node is selected, all its child nodes will be selected.
table/check-strictly
:::
Summary row
For table of numbers, you can add an extra row at the table footer displaying each column's sum.
:::demo You can add the summary row by setting show-summary to true. By default, for the summary row, the first column does not sum anything up but always displays 'Sum' (you can configure the displayed text using sum-text), while other columns sum every number in that column up and display them. You can of course define your own sum behaviour. To do so, pass a method to summary-method, which returns an array, and each element of the returned array will be displayed in the columns of the summary row, It can be a VNode or string. The second table of this example is a detailed demo.
table/summary
:::
Rowspan and colspan
Configuring rowspan and colspan allows you to merge cells
:::demo Use the span-method attribute to configure rowspan and colspan. It accepts a method, and passes an object to that method including current row row, current column column, current row index rowIndex and current column index columnIndex. The method should return an array of two numbers, the first number being rowspan and second colspan. It can also return an object with rowspan and colspan props.
table/rowspan-and-colspan
:::
Custom index
You can customize row index in type=index columns.
:::demo To customize row indices, use index attribute on el-table-column with type=index. If it is assigned to a number, all indices will have an offset of that number. It also accepts a method with each index (starting from 0) as parameter, and the returned value will be displayed as index.
table/custom-index
:::
Table Layout
The table-layout property sets the algorithm used to lay out table cells, rows, and columns.
:::demo
table/table-layout
:::
Tooltip formatter ^(2.9.4)
You can use tooltip-formatter to customize the tooltip content.
:::demo
table/tooltip-formatter
:::
Table API
Table Attributes
| Name | Description | Type | Default |
|---|---|---|---|
| data | table data | ^[array]any[] |
[] |
| height | table's height. By default it has an auto height. If its value is a number, the height is measured in pixels; if its value is a string, the value will be assigned to element's style.height, the height is affected by external styles |
^[string] / ^[number] | — |
| max-height | table's max-height. The legal value is a number or the height in px | ^[string] / ^[number] | — |
| stripe | whether Table is striped | ^[boolean] | false |
| border | whether Table has vertical border | ^[boolean] | false |
| size | size of Table | ^[enum]'' | 'large' | 'default' | 'small' |
— |
| fit | whether width of column automatically fits its container | ^[boolean] | true |
| show-header | whether Table header is visible | ^[boolean] | true |
| highlight-current-row | whether current row is highlighted | ^[boolean] | false |
| current-row-key | key of current row, a set only prop | ^[string] / ^[number] | — |
| row-class-name | function that returns custom class names for a row, or a string assigning class names for every row | ^[Function](data: { row: any, rowIndex: number }) => string / ^[string] |
— |
| row-style | function that returns custom style for a row, or an object assigning custom style for every row | ^[Function](data: { row: any, rowIndex: number }) => CSSProperties / ^[object]CSSProperties |
— |
| cell-class-name | function that returns custom class names for a cell, or a string assigning class names for every cell | ^[Function](data: { row: any, column: any, rowIndex: number, columnIndex: number }) => string / ^[string] |
— |
| cell-style | function that returns custom style for a cell, or an object assigning custom style for every cell | ^[Function](data: { row: any, column: any, rowIndex: number, columnIndex: number }) => CSSProperties / ^[object]CSSProperties |
— |
| header-row-class-name | function that returns custom class names for a row in table header, or a string assigning class names for every row in table header | ^[Function](data: { row: any, rowIndex: number }) => string / ^[string] |
— |
| header-row-style | function that returns custom style for a row in table header, or an object assigning custom style for every row in table header | ^[Function](data: { row: any, rowIndex: number }) => CSSProperties / ^[object]CSSProperties |
— |
| header-cell-class-name | function that returns custom class names for a cell in table header, or a string assigning class names for every cell in table header | ^[Function](data: { row: any, column: any, rowIndex: number, columnIndex: number }) => string / ^[string] |
— |
| header-cell-style | function that returns custom style for a cell in table header, or an object assigning custom style for every cell in table header | ^[Function](data: { row: any, column: any, rowIndex: number, columnIndex: number }) => CSSProperties / ^[object]CSSProperties |
— |
| row-key | key of row data, used for optimizing rendering. Required if reserve-selection is on or display tree data. When its type is String, multi-level access is supported, e.g. user.info.id, but user.info[0].id is not supported, in which case Function should be used |
^[function](row: any) => string / ^[string] |
— |
| empty-text | displayed text when data is empty. You can customize this area with #empty |
^[string] | No Data |
| default-expand-all | whether expand all rows by default, works when the table has a column type="expand" or contains tree structure data | ^[boolean] | false |
| expand-row-keys | set expanded rows by this prop, prop's value is the keys of expand rows, you should set row-key before using this prop | ^[array]string[] |
— |
| default-sort | set the default sort column and order. property prop is used to set default sort column, property order is used to set default sort order |
^[object]Sort |
if prop is set, and order is not set, then order is default to ascending |
| tooltip-effect | the effect of the overflow tooltip |
^[enum]'dark' | 'light' |
dark |
| tooltip-options ^(2.2.28) | the options for the overflow tooltip, see the following tooltip component | ^[object]Pick<ElTooltipProps, 'effect' | 'enterable' | 'hideAfter' | 'offset' | 'placement' | 'popperClass' | 'popperOptions' | 'showAfter' | 'showArrow'> |
^[object]{ enterable: true, placement: 'top', showArrow: true, hideAfter: 200, popperOptions: { strategy: 'fixed' } } |
| append-filter-panel-to ^(2.8.4) | which element the filter panels appends to | ^[string] | — |
| show-summary | whether to display a summary row | ^[boolean] | false |
| sum-text | displayed text for the first column of summary row | ^[string] | Sum |
| summary-method | custom summary method | ^[Function](data: { columns: any[], data: any[] }) => (VNode | string)[] |
— |
| span-method | method that returns rowspan and colspan | ^[Function](data: { row: any, column: any, rowIndex: number, columnIndex: number }) => number[] | { rowspan: number, colspan: number } | void |
— |
| select-on-indeterminate | controls the behavior of master checkbox in multi-select tables when only some rows are selected (but not all). If true, all rows will be selected, else deselected | ^[boolean] | true |
| indent | horizontal indentation of tree data | ^[number] | 16 |
| lazy | whether to lazy loading data | ^[boolean] | false |
| load | method for loading child row data, only works when lazy is true |
^[Function](row: any, treeNode: TreeNode, resolve: (data: any[]) => void) => void |
— |
| tree-props | configuration for rendering nested data | ^[object]{ hasChildren?: string, children?: string, checkStrictly?: boolean } |
^[object]{ hasChildren: 'hasChildren', children: 'children', checkStrictly: false } |
| table-layout | sets the algorithm used to lay out table cells, rows, and columns | ^[enum]'fixed' | 'auto' |
fixed |
| scrollbar-always-on | always show scrollbar | ^[boolean] | false |
| show-overflow-tooltip | whether to hide extra content and show them in a tooltip when hovering on the cell.It will affect all the table columns, refer to table tooltip-options | ^[boolean] / object ^(2.3.7) |
— |
| flexible ^(2.2.1) | ensure main axis minimum-size doesn't follow the content | ^[boolean] | false |
| scrollbar-tabindex ^(2.8.3) | body scrollbar's wrap container tabindex | ^[string] / ^[number] | — |
| allow-drag-last-column ^(2.9.2) | whether to allow drag the last column | ^[boolean] | true |
| tooltip-formatter ^(2.9.4) | customize tooltip content when using show-overflow-tooltip |
^[Function](data: { row: any, column: any, cellValue: any }) => VNode | string |
— |
Table Events
| Name | Description | Type |
|---|---|---|
| select | triggers when user clicks the checkbox in a row | ^[Function]<T = any>(selection: T[], row: T) => void |
| select-all | triggers when user clicks the checkbox in table header | ^[Function](selection: any[]) => void |
| selection-change | triggers when selection changes | ^[Function](newSelection: any[]) => void |
| cell-mouse-enter | triggers when hovering into a cell | ^[Function](row: any, column: any, cell: HTMLTableCellElement, event: Event) => void |
| cell-mouse-leave | triggers when hovering out of a cell | ^[Function](row: any, column: any, cell: HTMLTableCellElement, event: Event) => void |
| cell-click | triggers when clicking a cell | ^[Function](row: any, column: any, cell: HTMLTableCellElement, event: Event) => void |
| cell-dblclick | triggers when double clicking a cell | ^[Function](row: any, column: any, cell: HTMLTableCellElement, event: Event) => void |
| cell-contextmenu | triggers when user right clicks on a cell | ^[Function](row: any, column: any, cell: HTMLTableCellElement, event: Event) => void |
| row-click | triggers when clicking a row | ^[Function](row: any, column: any, event: Event) => void |
| row-contextmenu | triggers when user right clicks on a row | ^[Function](row: any, column: any, event: Event) => void |
| row-dblclick | triggers when double clicking a row | ^[Function](row: any, column: any, event: Event) => void |
| header-click | triggers when clicking a column header | ^[Function](column: any, event: Event) => void |
| header-contextmenu | triggers when user right clicks on a column header | ^[Function](column: any, event: Event) => void |
| sort-change | triggers when Table's sorting changes | ^[Function](data: {column: any, prop: string, order: any }) => void |
| filter-change | column's key. If you need to use the filter-change event, this attribute is mandatory to identify which column is being filtered | ^[Function](newFilters: any) => void |
| current-change | triggers when current row changes | ^[Function](currentRow: any, oldCurrentRow: any) => void |
| header-dragend | triggers after changing a column's width by dragging the column header's border | ^[Function](newWidth: number, oldWidth: number, column: any, event: MouseEvent) => void |
| expand-change | triggers when user expands or collapses a row (for expandable table, second param is expandedRows; for tree Table, second param is expanded) | ^[Function](row: any, expandedRows: any[]) => void & (row: any, expanded: boolean) => void |
| scroll ^(2.9.0) | Invoked after scrolled | ^[Function]({ scrollLeft: number, scrollTop: number }) => void |
Table Slots
| Name | Description | Subtags |
|---|---|---|
| default | customize default content | Table-column |
| append | Contents to be inserted after the last row. You may need this slot if you want to implement infinite scroll for the table. This slot will be displayed above the summary row if there is one. | — |
| empty | you can customize content when data is empty. | — |
Table Exposes
| Method | Description | Type |
|---|---|---|
| clearSelection | used in multiple selection Table, clear user selection | ^[Function]() => void |
| getSelectionRows | returns the currently selected rows | ^[Function]() => any[] |
| toggleRowSelection | used in multiple selection Table, toggle if a certain row is selected. With the second parameter, you can directly set if this row is selected | ^[Function](row: any, selected?: boolean, ignoreSelectable = true) => void |
| toggleAllSelection | used in multiple selection Table, toggle select all and deselect all | ^[Function]() => void |
| toggleRowExpansion | used in expandable Table or tree Table, toggle if a certain row is expanded. With the second parameter, you can directly set if this row is expanded or collapsed | ^[Function](row: any, expanded?: boolean) => void |
| setCurrentRow | used in single selection Table, set a certain row selected. If called without any parameter, it will clear selection | ^[Function](row: any) => void |
| clearSort | clear sorting, restore data to the original order | ^[Function]() => void |
| clearFilter | clear filters of the columns whose columnKey are passed in. If no params, clear all filters |
^[Function](columnKeys?: string[]) => void |
| doLayout | refresh the layout of Table. When the visibility of Table changes, you may need to call this method to get a correct layout | ^[Function]() => void |
| sort | sort Table manually. Property prop is used to set sort column, property order is used to set sort order |
^[Function](prop: string, order: string) => void |
| scrollTo | scrolls to a particular set of coordinates | ^[Function](options: number | ScrollToOptions, yCoord?: number) => void |
| setScrollTop | set vertical scroll position | ^[Function](top?: number) => void |
| setScrollLeft | set horizontal scroll position | ^[Function](left?: number) => void |
| columns ^(2.7.6) | Get table columns context. | ^[array]TableColumnCtx<T>[] |
| updateKeyChildren ^(2.8.4) | used in lazy Table, must set rowKey, update key children |
^[Function](key: string, data: T[]) => void |
Table-column API
Table-column Attributes
| Name | Description | Type | Default |
|---|---|---|---|
| type | type of the column. If set to selection, the column will display checkbox. If set to index, the column will display index of the row (staring from 1). If set to expand, the column will display expand icon |
^[enum]'default' | 'selection' | 'index' | 'expand' |
default |
| index | customize indices for each row, works on columns with type=index |
^[number] / ^[Function](index: number) => number |
— |
| label | column label | ^[string] | — |
| column-key | column's key. If you need to use the filter-change event, you need this attribute to identify which column is being filtered | ^[string] | — |
| prop | field name. You can also use its alias: property |
^[string] | — |
| width | column width | ^[string] / ^[number] | '' |
| min-width | column minimum width. Columns with width has a fixed width, while columns with min-width has a width that is distributed in proportion |
^[string] / ^[number] | '' |
| fixed | whether column is fixed at left / right. Will be fixed at left if true |
^[enum]'left' | 'right' / ^[boolean] |
false |
| render-header | render function for table header of this column | ^[Function](data: { column: any, $index: number }) => void |
— |
| sortable | whether column can be sorted. Remote sorting can be done by setting this attribute to 'custom' and listening to the sort-change event of Table |
^[boolean] / ^[string] | false |
| sort-method | sorting method, works when sortable is true. Should return a number, just like Array.sort |
^[Function]<T = any>(a: T, b: T) => number |
— |
| sort-by | specify which property to sort by, works when sortable is true and sort-method is undefined. If set to an Array, the column will sequentially sort by the next property if the previous one is equal |
^[Function](row: any, index: number) => string / ^[string] / ^[object]string[] |
— |
| sort-orders | the order of the sorting strategies used when sorting the data, works when sortable is true. Accepts an array, as the user clicks on the header, the column is sorted in order of the elements in the array |
^[object]('ascending' | 'descending' | null)[] |
['ascending', 'descending', null] |
| resizable | whether column width can be resized, works when border of el-table is true |
^[boolean] | true |
| formatter | function that formats cell content | ^[function](row: any, column: any, cellValue: any, index: number) => VNode | string |
— |
| show-overflow-tooltip | whether to hide extra content and show them in a tooltip when hovering on the cell | ^[boolean] / object ^(2.2.28) |
undefined |
| align | alignment | ^[enum]'left' | 'center' | 'right' |
left |
| header-align | alignment of the table header. If omitted, the value of the above align attribute will be applied |
^[enum]'left' | 'center' | 'right' |
left |
| class-name | class name of cells in the column | ^[string] | — |
| label-class-name | class name of the label of this column | ^[string] | — |
| selectable | function that determines if a certain row can be selected, works when type is 'selection' |
^[Function](row: any, index: number) => boolean |
— |
| reserve-selection | whether to reserve selection after data refreshing, works when type is 'selection'. Note that row-key is required for this to work |
^[boolean] | false |
| filters | an array of data filtering options. For each element in this array, text and value are required |
^[array]Array<{text: string, value: string}> |
— |
| filter-placement | placement for the filter dropdown | ^[enum]'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end' | 'right' | 'right-start' | 'right-end' |
— |
| filter-class-name ^(2.5.0) | className for the filter dropdown | ^[string] | — |
| filter-multiple | whether data filtering supports multiple options | ^[boolean] | true |
| filter-method | data filtering method. If filter-multiple is on, this method will be called multiple times for each row, and a row will display if one of the calls returns true |
^[function](value: any, row: any, column: any) => void |
— |
| filtered-value | filter value for selected data, might be useful when table header is rendered with render-header |
^[object]string[] |
— |
| tooltip-formatter ^(2.9.4) | customize tooltip content when using show-overflow-tooltip |
^[Function](data: { row: any, column: any, cellValue: any }) => VNode | string |
— |
Table-column Slots
| Name | Description | Type |
|---|---|---|
| default | Custom content for table columns | ^[object]{ row: any, column: any, $index: number } |
| header | Custom content for table header | ^[object]{ column: any, $index: number } |
| filter-icon ^(2.7.8) | Custom content for filter icon | ^[object]{ filterOpened: boolean } |
Type Declarations
Show declarations
interface Sort {
prop: string
order: 'ascending' | 'descending'
init?: any
silent?: any
}
interface TreeNode {
expanded?: boolean
loading?: boolean
noLazyChildren?: boolean
indent?: number
level?: number
display?: boolean
}
FAQ
How to use image preview in the table?
<template>
<el-table-column width="180">
<template #default="scope">
<el-image preview-teleported :preview-src-list="srcList" />
</template>
</el-table-column>
</template>
Why column is not rendered when use DOM templates?
Typical issue: #5046 #5862 #6919
This is because the HTML spec only allows a few specific elements to omit closing tags, the most common being <input> and <img>. For all other elements, if you omit the closing tag, the native HTML parser will think you never terminated the opening tag
For more details please refer to vue docs