VSeed, an elegant data composer, transforming complexity into simplicity.
!!!###!!!title=custom icon——VisActor/VTable tutorial documents!!!###!!!!!!###!!!description=In VTable, we can use the custom icon function to improve the readability and visual effect of the table. This tutorial will mainly introduce how to use the icon, how to register it, and how to reset the function icon.!!!###!!!
Icon use
In VTable, we can use the custom icon function to improve the readability and visual effect of the table. This tutorial will mainly introduce how to use the icon, how to register it, and how to reset the function icon.
Define icon
We can configure the cell icons displayed in the header and body through icon and headerIcon respectively:
headerIcon Header cell icon configuration, which can help us set the icon style of the header. Configuration items are based on ColumnIconOption The type is defined, and you can refer to the given configuration for details.
icon The icon used to configure the body cell.
The specific configuration content is an object of type ColumnIconOption. You can also pass a custom function to dynamically set the icon style of the cell. For the specific definition of ColumnIconOption, please refer to: https://visactor.io/vtable/option/ListTable-columns-text#icon
Header icon configuration example
First, let's look at a use headerIcon Simple example of.
In this example, we configure a cell named Avatar Icon. The role of this icon is to display the avatar picture, and the value of the picture src is obtained from the field of the avator of records.
How to register the icon and use it after registration
In VTable, through register.icon Method, we can register custom icons and use them in the table. If you want to replace the built-in function icons, you can also do so by registering.
In addition, the registered icon can also be found in customLayout Used in.
Reset function icon
For built-in functional icons, such as pin, sort, etc., we can replace them by re-registering the icon of the same name. It should be noted that when re-registering the icon, be sure to configure funcType Properties to ensure that icons can be replaced correctly.
Example: Replacing the frozen freeze icon
Suppose we need to replace the relevant icon of the built-in frozen function, the code is as follows:
In the same way, we can replace other functional icons. Several icons related to internal functions are built into VTable, such as sorting, fixed columns, drop-down menu icons, Expand folding icons, etc.
The list of resettable internal icons is as follows:
Functions
Configure funcType
Configure name
Icon description
Sort
VTable. TYPES. IconFuncTypeEnum.sort
"sort_normal"
Sort function icon, normal unsorted status
Sort
VTable. TYPES. IconFuncTypeEnum.sort
"sort_upward"
Sort function icons, ascending status
Sort
VTable. TYPES. IconFuncTypeEnum.sort
"sort_downward"
Sort function icons, descending status
Fixed Column
VTable. TYPES. IconFuncTypeEnum.frozen
"freeze"
Fixed Column Function Icon, Fixed State
Fixed Columns
VTable. TYPES. IconFuncTypeEnum.frozen
"frozen"
Fixed Columns Function Icon, Fixed Status
Fixed Columns
VTable. TYPES. IconFuncTypeEnum.frozen
"frozenCurrent"
Fixed Columns Function Icon, Frozen When Columns
Image or video address invalid
VTable. TYPES. IconFuncTypeEnum.damagePic
"damage_pic"
Multimedia resource parsing failed
Loading
VTable. TYPES. IconFuncTypeEnum.loading_pic
"loading_pic"
Loading status
Image image type parsing failed
VTable. TYPES. IconFuncTypeEnum.imageDamagePic
"image_damage_pic"
Image resource parsing failed
Video video type parsing failed
VTable. TYPES. IconFuncTypeEnum.videoDamagePic
"video_damage_pic"
Video resource parsing failed
Tree Structure Folding
VTable. TYPES. IconFuncTypeEnum.collapse
"collapse"
Tree Structure Folded State
Tree Structure Expand
VTable. TYPES. IconFuncTypeEnum.expand
"expand"
Tree Structure Expand State
Tree Structure Folding
VTable. TYPES. IconFuncTypeEnum.collapse
"collapse"
Tree Structure Folded State
Drop-down menu
VTable. TYPES. IconFuncTypeEnum.dropDown
"downward"
Drop-down icon normal status
dropdown menu
VTable. TYPES. IconFuncTypeEnum.dropDown
"downward_hover"
dropdown icon hover status
Row drag and drop
VTable.TYPES.IconFuncTypeEnum.dragReorder
"dragReorder"
Drag and drop row order, visible when rowSeriesNumber is configured
It should be noted: The built-in charts in the list have their own special functions and can be reset, but they cannot be configured in the definition of headerIcon or icon! The following incorrect usage:
columns: [
{
field: 'Sales',
title: 'Sales',
width: 'auto',
sort: true,
headerIcon: 'expand' // expand is an internal keyword. If you need to use it, please register other names to replace headerIcon.
},
]
At the same time, the icons registered in your own business do not need to configure funcType.
At this point, the tutorial on how to use icons in VTable, register and replace function icons is all introduced. I hope this tutorial can help you better understand and use VTable, and create a more beautiful and practical data lake visualization table