@@ -1122,13 +1122,15 @@ You can also select multiple rows.
...
@@ -1122,13 +1122,15 @@ You can also select multiple rows.
Sort the data to find or compare data quickly.
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`. 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.
:::demo Set table attribute `default-sort-prop` and `default-sort-order` to determine default sort column and order. Set attribute `sortable` in a certain column to sort the data based on this column. It accepts `Boolean` with a default value `false`. 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.
```html
```html
<template>
<template>
<el-table
<el-table
:data="tableData"
:data="tableData"
border
border
style="width: 100%">
style="width: 100%"
default-sort-prop="date"
default-sort-order="descending">
<el-table-column
<el-table-column
prop="date"
prop="date"
label="Date"
label="Date"
...
@@ -1453,6 +1455,8 @@ When the row content is too long and you do not want to display the horizontal s
...
@@ -1453,6 +1455,8 @@ When the row content is too long and you do not want to display the horizontal s
| empty-text | Displayed text when data is empty. You can customize this area with `slot="empty"` | String | — | No Data |
| empty-text | Displayed text when data is empty. You can customize this area with `slot="empty"` | String | — | No Data |
| default-expand-all | whether expand all rows by default, only works when the table has a column type="expand" | Boolean | — | false |
| default-expand-all | whether expand all rows by default, only works when the table has a column type="expand" | 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 | — | |
| 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 | — | |
| default-sort-prop | set the `prop` of default sort column. | String | - | - |
| default-sort-order | set the default sort order. You should set `default-sort-prop` before using this prop. | String | ascending, descending | ascending |