Data table
Extended from PrimeVue DataTable
Basic example
Advantages | Disadvantages |
|---|---|
| Saves money on electricity | Savings are lower than with a solar loan or cash purchases |
| Low or no upfront costs | Can't take advantage of state and local incentives |
| May be an attractive feature to some homebuyers | Complicates selling your home |
| No maintenance responsibilities | Leasing companies sometimes neglect their maintenance responsibilities |
Empty example
Advantages | Disadvantages |
|---|---|
No data found | |
Custom rendering
Cost before | Cost after | |
|---|---|---|
| Local rebate | $10,000 | $8,000 |
| State tax credit | $20,000 | $10,000 |
| Larger state tax credit | $30,000 | $20,000 |
Sortable
Apply the sortable prop to a column to indicate that the user should be able to change the sort order of the rows based on that column's data. To set the initial state of the table to be sorted by a particular column, use the sortField and sortOrder props of the data table.
Name | Abbreviation | Capital | Year admitted |
|---|---|---|---|
| Alabama | AL | Montgomery | 1819 |
| Alaska | AK | Juneau | 1959 |
| Arizona | AZ | Phoeniz | 1912 |
| Arkansas | AR | Little Rock | 1836 |
| California | CA | Sacramento | 1850 |
| Colorado | CO | Denver | 1876 |
| Connecticut | CT | Hartford | 1788 |
| Delaware | DE | Dover | 1787 |
| Florida | FL | Tallahassee | 1845 |
| Georgia | GA | Atlanta | 1788 |
| Hawaii | HI | Honolulu | 1959 |
| Idaho | ID | Boise | 1890 |
| Illinois | IL | Springfield | 1818 |
| Indiana | IN | Indianapolis | 1816 |
| Iowa | IA | Des Moines | 1846 |
| Kansas | KS | Topeka | 1861 |
| Kentucky | KY | Frankfort | 1792 |
Limited height with sticky header
For long tables, it's possible to show a limited number of rows by setting a fixed height. The user can then scroll within the table to see the remaining rows.
It's best to use this sparingly, since this causes a situation of double scrolling and can make it difficult for users on touch devices to scroll past the table without scrolling to the end of the table. If it must be used, try to set the fixed height such that a partial row is visible, to indicate to the user there is more content that can be scrolled into view.
Name | Abbreviation | Capital | Year admitted |
|---|---|---|---|
| Alabama | AL | Montgomery | 1819 |
| Alaska | AK | Juneau | 1959 |
| Arizona | AZ | Phoeniz | 1912 |
| Arkansas | AR | Little Rock | 1836 |
| California | CA | Sacramento | 1850 |
| Colorado | CO | Denver | 1876 |
| Connecticut | CT | Hartford | 1788 |
| Delaware | DE | Dover | 1787 |
| Florida | FL | Tallahassee | 1845 |
| Georgia | GA | Atlanta | 1788 |
| Hawaii | HI | Honolulu | 1959 |
| Idaho | ID | Boise | 1890 |
| Iowa | IA | Des Moines | 1846 |
| Illinois | IL | Springfield | 1818 |
| Indiana | IN | Indianapolis | 1816 |
| Kansas | KS | Topeka | 1861 |
| Kentucky | KY | Frankfort | 1792 |
Freeze one column
This example shows how to use the frozen prop on a column to ensure it stays visible while scrolling the table contents horizontally. This feature is especially useful on mobile when the first column contains primary information that is important to reference when reading the contents of the subsequent columns.
Name | Abbreviation | Capital | Year admitted |
|---|---|---|---|
| Alabama | AL | Montgomery | 1819 |
| Alaska | AK | Juneau | 1959 |
| Arizona | AZ | Phoeniz | 1912 |
| Arkansas | AR | Little Rock | 1836 |
| California | CA | Sacramento | 1850 |
| Colorado | CO | Denver | 1876 |
| Connecticut | CT | Hartford | 1788 |
| Delaware | DE | Dover | 1787 |
| Florida | FL | Tallahassee | 1845 |
| Georgia | GA | Atlanta | 1788 |
| Hawaii | HI | Honolulu | 1959 |
| Idaho | ID | Boise | 1890 |
| Iowa | IA | Des Moines | 1846 |
| Illinois | IL | Springfield | 1818 |
| Indiana | IN | Indianapolis | 1816 |
| Kansas | KS | Topeka | 1861 |
| Kentucky | KY | Frankfort | 1792 |
EsDataTable props
For additional EsDataTable props beyond the ones listed below, please reference the PrimeVue DataTable props. Note that styling for features of the data table not demonstrated above may not be supported.
- Name
items
- Type
Array
- Default
- n/a
- Description
- Required. An array of objects to display.
- Name
scrollable
- Type
Boolean
- Default
false
- Description
- When specified, limits the height of the table and enables scrolling.
- Name
scrollHeight
- Type
String
- Default
305px
- Description
- Height of the scrollable table. Only applies when scrollable is true.
EsDataTableColumn props
For the props available to pass into EsDataTableColumn, please reference the PrimeVue Column props.