﻿# nf-table {#table}

Data table with search, pagination, column settings, renderers, action bars and virtual scrolling.

Table column settings and resized widths use IndexedDB (the `nf-table` object store in the `common-ui-plus` database), restored asynchronously without a localStorage fallback or automatic migration of old caches. Await `clearColumnEditCached()`, `clearDragCached()` and the legacy `*Cookies*` synchronization methods to wait for completion. If IndexedDB is unavailable, the current instance remains usable. Search form field settings use the `nf-search-form` object store in the same database.

```ts
import NfTable from '@94ai-plus/nf-table'
import type { NfTableColumnAttributes, TableSearchEvent } from '@94ai-plus/nf-table'
import '@94ai-plus/nf-table/style.css'
```

<span id="basic"></span>

<span id="remote"></span>

## Easy configuration {#example-1}

### Easy configuration
```vue
<script setup>
import { ref, reactive, h, onBeforeUnmount } from 'vue'
import { ElInput, ElDivider, ElCheckbox, ElPagination, ElTooltip, ElIcon, ElTableColumn, ElForm, ElFormItem } from 'element-plus'
import { QuestionFilled } from '@element-plus/icons-vue'
import { NfTable, NfSearchForm, NfButton, NfEmpty } from '@94ai-plus/common-ui'
const result = ref('')
const showStartTime = ref(false)
const report = (action, row) => result.value = action + (row ? ': ' + row.id : '')
const makeRows = (count, offset = 0) => Array.from({length:count}, (_, i) => ({
  id:offset+i+1, name:'Task'+(offset+i+1), taskId:i%3+1, companyName:'enterprise'+(i%3+1),
  operationName:'person in charge'+(i+1), viceOperationName:'collaborator'+(i+1), startTime:'2026-01-01',
  completionRate:i%2?0.6:1, unit:50+i%50, getOptionsId:i%3+1, address:'address'+(i+1)
}))
const fields = [
  {prop:'normalInputBox',label:'Ordinary input box',element:'el-input',placeholder:'Enter task name'},
  {prop:'numberInputBox',label:'Number input box',element:'el-input-number',placeholder:'After inputting, search will clear the data.'},
  {prop:'normalDropdown',label:'Normal drop-down',element:'el-select',options:[{label:'Query new10piece of data',value:1},{label:'The query data result is10Article',value:2}]},
  {prop:'virtualDropdown',label:'Virtual drop-down',element:'nf-virtual-select',options:[{label:'Give me some advice',value:'1'},{label:'After-sales issues',value:'2'}]},
  {prop:'opinion',label:'opinion',element:'el-input',placeholder:'Show or hide based on virtual drop-down',destory:formData=>formData.virtualDropdown!=='1'},
  {prop:'slotInput',label:'nf-tableSlot input box',slot:'slotInput'},
]
const secondFields = [...fields.filter(field=>!['opinion','slotInput'].includes(field.prop)),
  {prop:'dynamicSlot',label:'fromNfSearchFormCustom transparent transmission dynamicsslot',slot:'dynamicNfSearchFormSlot'},
  {prop:'repeatCount',label:'testnumber-range',element:'number-range',tag:'el-input',initValue:[],limitRange:[1,9999],inputSlot:{append:'repeatCountAppend',doubleAppend:'doubleRepeatCountAppend',doubleSegment:'doubleRepeatCountAppendSegment'}}]
const searchAttrs = {formOptions:fields,btnItems:['search'],columns:4,btnModel:'inline',columnEdit:true}
function useTable(key) {
  const table = ref(), rows = ref(makeRows(20)), allSelected = ref(false)
  const columns = ref([
    {type:'selection',prop:'selection',label:'Choose',attr:{width:64,fixed:'left'}},
    {prop:'id',label:'id',labelTooltip:'Configurationtips',attr:{width:90}},
    {prop:'name',label:'Task name',attr:{minWidth:160}},
    {prop:'companyName',label:()=>showStartTime.value?'Owned company(There is a date on the right)':'Owned company(No date on the right)',attr:{minWidth:190}},
    {prop:'startTime',label:'launch date',destory:()=>!showStartTime.value,attr:{minWidth:150}},
    {prop:'unit',label:'unitdata unit',unit:'%',attr:{minWidth:135}},
    {prop:'taskId',label:'optionsMapping name',options:[{label:'Task1',value:1,tagType:'success'},{label:'Task2',value:2},{label:'Task3',value:3}],attr:{minWidth:150}},
    {prop:'getOptionsId',label:'getOptionsMapping name',getOptions:done=>done([{label:'dynamic mapping1',value:1},{label:'dynamic mapping2',value:2,tagType:'tip'},{label:'dynamic mapping3',value:3}]),attr:{minWidth:190}},
    {prop:'operation',label:'Operation',attr:{fixed:'right',minWidth:210},operationSpan:3,operationList:scope=>[
      {name:'Details',onClick:row=>report('Details',row)},
      {name:'Edit',destroy:row=>row.completionRate===1,onClick:row=>report('Edit',row)},
      {name:'Voice notification',onClick:row=>report('Voice notification',row)},
      {name:'Download',destroy:true,onClick:row=>report('Download',row)},
    ]},
  ])
  const actions = reactive([
    {element:'el-checkbox',value:false,text:'Select all on this page',events:{change:()=>table.value?.toggleAllSelection()}},
    ...['turn on','pause','Delete'].map((text,i)=>({element:'el-button',text,type:i?'danger':'primary',events:{click:()=>report(text)}})),
    {element:'el-button',get text(){return showStartTime.value?'Hide launch date':'Show launch date'},get type(){return showStartTime.value?'danger':'primary'},events:{click:()=>showStartTime.value=!showStartTime.value}},
  ])
  const onSelection = selection => {
    const selected = selection.length > 0 && selection.length === table.value?.showData.length
    allSelected.value = selected; actions[0].value = selected
    result.value = 'Selected:'+selection.length
  }
  const search = ({data, callback}) => {
    try {
      if (data.numberInputBox) rows.value = []
      else if (data.normalDropdown === 1) rows.value = [...rows.value,...makeRows(10,rows.value.length)]
      else if (data.normalDropdown === 2) rows.value = makeRows(10)
      else rows.value = makeRows(20).filter(row=>row.name.includes(data.normalInputBox || ''))
      result.value = JSON.stringify(data)
    } finally { callback() }
  }
  return {table,rows,columns,actions,allSelected,onSelection,search,key}
}

fields[0] = {...fields[0],label:'Required input box',rules:[{required:true,message:'Please enter',trigger:'blur'}]}
const states = [useTable('first'),useTable('second')]
</script>

<template>
<div class="table-examples">
<div>
<NfTable :ref="value => states[0].table.value = value" :data="states[0].rows.value" :columns="states[0].columns.value"
  :search-form-attrs="{...searchAttrs,formOptions:fields,requiredValidate:true}" :action-bar-opt-list="states[0].actions" :page-attrs="{pageSize:5}"
  :table-attrs="{rowKey:'id',headerCellStyle:({column})=>({background:'var(--el-fill-color-light)',textAlign:column.property==='operation'?'left':'center'}),cellStyle:{textAlign:'center'}}"
  column-edit check-mode="dialog" storage-key="docs-table-1-1-en" search-form-storage-key="docs-search-table-1-1-en" :cal-height="false"
  set-easy-conf @search-api="states[0].search" @selection-change="states[0].onSelection">
  <template #slotInput="{formData}"><ElInput v-model="formData.slotInput" clearable /></template>
  <template #dynamicNfSearchFormSlot="{formData}"><ElInput v-model="formData.dynamicSlot" clearable /></template>
  <template #repeatCountAppend>times</template><template #doubleRepeatCountAppend>times</template><template #doubleRepeatCountAppendSegment>to</template>
</NfTable></div>
<ElDivider>The parent container above has no height limit</ElDivider><ElDivider>The height limit of the parent container below</ElDivider><div class="table-fixed">
<NfTable :ref="value => states[1].table.value = value" :data="states[1].rows.value" :columns="states[1].columns.value"
  :search-form-attrs="{...searchAttrs,formOptions:secondFields,requiredValidate:false}" :action-bar-opt-list="states[1].actions" :page-attrs="{pageSize:5}"
  :table-attrs="{rowKey:'id',headerCellStyle:({column})=>({background:'var(--el-fill-color-light)',textAlign:column.property==='operation'?'left':'center'}),cellStyle:{textAlign:'center'}}"
  column-edit check-mode="dialog" storage-key="docs-table-1-2-en" search-form-storage-key="docs-search-table-1-2-en" :cal-height="true"
  set-easy-conf @search-api="states[1].search" @selection-change="states[1].onSelection">
  <template #slotInput="{formData}"><ElInput v-model="formData.slotInput" clearable /></template>
  <template #dynamicNfSearchFormSlot="{formData}"><ElInput v-model="formData.dynamicSlot" clearable /></template>
  <template #repeatCountAppend>times</template><template #doubleRepeatCountAppend>times</template><template #doubleRepeatCountAppendSegment>to</template>
</NfTable></div>

<output aria-live="polite">{{ result }}</output>
</div>
</template>

<style scoped>
.table-examples {max-width:100%;min-width:0}
.table-fixed {height:420px;min-height:0}
.table-examples output {display:block;margin-top:16px;overflow-wrap:anywhere}
.table-examples :deep(.el-divider__text) {max-width:90%;white-space:normal;font-size:12px}
.table-examples :deep(.el-divider--horizontal) {margin:40px 0}
.table-examples :deep(.nf-search-form-control) {max-width:100%}
.table-examples :deep(.el-form--inline) {display:flex;flex-wrap:wrap;gap:0}
@media(max-width:600px){.table-examples :deep(.nf-search-form-item){max-width:100%;margin-right:0}.table-examples :deep(.el-form-item__content){min-width:0}}
</style>
```

## Data-driven customization {#example-2}

### Data-driven customization
```vue
<script setup>
import { ref, reactive, h, onBeforeUnmount } from 'vue'
import { ElInput, ElDivider, ElCheckbox, ElPagination, ElTooltip, ElIcon, ElTableColumn, ElForm, ElFormItem } from 'element-plus'
import { QuestionFilled } from '@element-plus/icons-vue'
import { NfTable, NfSearchForm, NfButton, NfEmpty } from '@94ai-plus/common-ui'
const result = ref('')
const showStartTime = ref(false)
const report = (action, row) => result.value = action + (row ? ': ' + row.id : '')
const makeRows = (count, offset = 0) => Array.from({length:count}, (_, i) => ({
  id:offset+i+1, name:'Task'+(offset+i+1), taskId:i%3+1, companyName:'enterprise'+(i%3+1),
  operationName:'person in charge'+(i+1), viceOperationName:'collaborator'+(i+1), startTime:'2026-01-01',
  completionRate:i%2?0.6:1, unit:50+i%50, getOptionsId:i%3+1, address:'address'+(i+1)
}))
const fields = [
  {prop:'normalInputBox',label:'Ordinary input box',element:'el-input',placeholder:'Enter task name'},
  {prop:'numberInputBox',label:'Number input box',element:'el-input-number',placeholder:'After inputting, search will clear the data.'},
  {prop:'normalDropdown',label:'Normal drop-down',element:'el-select',options:[{label:'Query new10piece of data',value:1},{label:'The query data result is10Article',value:2}]},
  {prop:'virtualDropdown',label:'Virtual drop-down',element:'nf-virtual-select',options:[{label:'Give me some advice',value:'1'},{label:'After-sales issues',value:'2'}]},
  {prop:'opinion',label:'opinion',element:'el-input',placeholder:'Show or hide based on virtual drop-down',destory:formData=>formData.virtualDropdown!=='1'},
  {prop:'slotInput',label:'nf-tableSlot input box',slot:'slotInput'},
]
const secondFields = [...fields.filter(field=>!['opinion','slotInput'].includes(field.prop)),
  {prop:'dynamicSlot',label:'fromNfSearchFormCustom transparent transmission dynamicsslot',slot:'dynamicNfSearchFormSlot'},
  {prop:'repeatCount',label:'testnumber-range',element:'number-range',tag:'el-input',initValue:[],limitRange:[1,9999],inputSlot:{append:'repeatCountAppend',doubleAppend:'doubleRepeatCountAppend',doubleSegment:'doubleRepeatCountAppendSegment'}}]
const searchAttrs = {formOptions:fields,btnItems:['search'],columns:4,btnModel:'inline',columnEdit:true}
function useTable(key) {
  const table = ref(), rows = ref(makeRows(20)), allSelected = ref(false)
  const columns = ref([
    {type:'selection',prop:'selection',label:'Choose',attr:{width:64,fixed:'left'}},
    {prop:'id',label:'id',labelTooltip:'Configurationtips',attr:{width:90}},
    {prop:'name',label:'Task name',attr:{minWidth:160}},
    {prop:'companyName',label:()=>showStartTime.value?'Owned company(There is a date on the right)':'Owned company(No date on the right)',attr:{minWidth:190}},
    {prop:'startTime',label:'launch date',destory:()=>!showStartTime.value,attr:{minWidth:150}},
    {prop:'unit',label:'unitdata unit',unit:'%',attr:{minWidth:135}},
    {prop:'taskId',label:'optionsMapping name',options:[{label:'Task1',value:1,tagType:'success'},{label:'Task2',value:2},{label:'Task3',value:3}],attr:{minWidth:150}},
    {prop:'getOptionsId',label:'getOptionsMapping name',getOptions:done=>done([{label:'dynamic mapping1',value:1},{label:'dynamic mapping2',value:2,tagType:'tip'},{label:'dynamic mapping3',value:3}]),attr:{minWidth:190}},
    {prop:'operation',label:'Operation',attr:{fixed:'right',minWidth:210},operationSpan:3,operationList:scope=>[
      {name:'Details',onClick:row=>report('Details',row)},
      {name:'Edit',destroy:row=>row.completionRate===1,onClick:row=>report('Edit',row)},
      {name:'Voice notification',onClick:row=>report('Voice notification',row)},
      {name:'Download',destroy:true,onClick:row=>report('Download',row)},
    ]},
  ])
  const actions = reactive([
    {element:'el-checkbox',value:false,text:'Select all on this page',events:{change:()=>table.value?.toggleAllSelection()}},
    ...['turn on','pause','Delete'].map((text,i)=>({element:'el-button',text,type:i?'danger':'primary',events:{click:()=>report(text)}})),
    {element:'el-button',get text(){return showStartTime.value?'Hide launch date':'Show launch date'},get type(){return showStartTime.value?'danger':'primary'},events:{click:()=>showStartTime.value=!showStartTime.value}},
  ])
  const onSelection = selection => {
    const selected = selection.length > 0 && selection.length === table.value?.showData.length
    allSelected.value = selected; actions[0].value = selected
    result.value = 'Selected:'+selection.length
  }
  const search = ({data, callback}) => {
    try {
      if (data.numberInputBox) rows.value = []
      else if (data.normalDropdown === 1) rows.value = [...rows.value,...makeRows(10,rows.value.length)]
      else if (data.normalDropdown === 2) rows.value = makeRows(10)
      else rows.value = makeRows(20).filter(row=>row.name.includes(data.normalInputBox || ''))
      result.value = JSON.stringify(data)
    } finally { callback() }
  }
  return {table,rows,columns,actions,allSelected,onSelection,search,key}
}

const states = [useTable('first'),useTable('second')]
</script>

<template>
<div class="table-examples">
<div>
<NfTable :ref="value => states[0].table.value = value" :data="states[0].rows.value" :columns="states[0].columns.value"
  :search-form-attrs="{...searchAttrs,formOptions:fields,requiredValidate:false}" :action-bar-opt-list="states[0].actions" :page-attrs="{pageSize:5}"
  :table-attrs="{rowKey:'id',headerCellStyle:({column})=>({background:'var(--el-fill-color-light)',textAlign:column.property==='operation'?'left':'center'}),cellStyle:{textAlign:'center'}}"
  column-edit check-mode="dialog" storage-key="docs-table-2-1-en" search-form-storage-key="docs-search-table-2-1-en" :cal-height="false"
  :init-search-api="true" :page-change-search-api="true" @search-api="states[0].search" @selection-change="states[0].onSelection">
  <template #slotInput="{formData}"><ElInput v-model="formData.slotInput" clearable /></template>
  <template #dynamicNfSearchFormSlot="{formData}"><ElInput v-model="formData.dynamicSlot" clearable /></template>
  <template #repeatCountAppend>times</template><template #doubleRepeatCountAppend>times</template><template #doubleRepeatCountAppendSegment>to</template>
</NfTable></div>
<ElDivider>The parent container above has no height limit</ElDivider><ElDivider>The height limit of the parent container below</ElDivider><div class="table-fixed">
<NfTable :ref="value => states[1].table.value = value" :data="states[1].rows.value" :columns="states[1].columns.value"
  :search-form-attrs="{...searchAttrs,formOptions:secondFields,requiredValidate:false}" :action-bar-opt-list="states[1].actions" :page-attrs="{pageSize:5}"
  :table-attrs="{rowKey:'id',headerCellStyle:({column})=>({background:'var(--el-fill-color-light)',textAlign:column.property==='operation'?'left':'center'}),cellStyle:{textAlign:'center'}}"
  column-edit check-mode="dialog" storage-key="docs-table-2-2-en" search-form-storage-key="docs-search-table-2-2-en" :cal-height="true"
  :init-search-api="true" :page-change-search-api="true" @search-api="states[1].search" @selection-change="states[1].onSelection">
  <template #slotInput="{formData}"><ElInput v-model="formData.slotInput" clearable /></template>
  <template #dynamicNfSearchFormSlot="{formData}"><ElInput v-model="formData.dynamicSlot" clearable /></template>
  <template #repeatCountAppend>times</template><template #doubleRepeatCountAppend>times</template><template #doubleRepeatCountAppendSegment>to</template>
</NfTable></div>

<output aria-live="polite">{{ result }}</output>
</div>
</template>

<style scoped>
.table-examples {max-width:100%;min-width:0}
.table-fixed {height:420px;min-height:0}
.table-examples output {display:block;margin-top:16px;overflow-wrap:anywhere}
.table-examples :deep(.el-divider__text) {max-width:90%;white-space:normal;font-size:12px}
.table-examples :deep(.el-divider--horizontal) {margin:40px 0}
.table-examples :deep(.nf-search-form-control) {max-width:100%}
.table-examples :deep(.el-form--inline) {display:flex;flex-wrap:wrap;gap:0}
@media(max-width:600px){.table-examples :deep(.nf-search-form-item){max-width:100%;margin-right:0}.table-examples :deep(.el-form-item__content){min-width:0}}
</style>
```

## Custom slots and fixed columns {#example-3}

### Custom slots and fixed columns
```vue
<script setup>
import { ref, reactive, h, onBeforeUnmount } from 'vue'
import { ElInput, ElDivider, ElCheckbox, ElPagination, ElTooltip, ElIcon, ElTableColumn, ElForm, ElFormItem } from 'element-plus'
import { QuestionFilled } from '@element-plus/icons-vue'
import { NfTable, NfSearchForm, NfButton, NfEmpty } from '@94ai-plus/common-ui'
const result = ref('')
const showStartTime = ref(false)
const report = (action, row) => result.value = action + (row ? ': ' + row.id : '')
const makeRows = (count, offset = 0) => Array.from({length:count}, (_, i) => ({
  id:offset+i+1, name:'Task'+(offset+i+1), taskId:i%3+1, companyName:'enterprise'+(i%3+1),
  operationName:'person in charge'+(i+1), viceOperationName:'collaborator'+(i+1), startTime:'2026-01-01',
  completionRate:i%2?0.6:1, unit:50+i%50, getOptionsId:i%3+1, address:'address'+(i+1)
}))
const fields = [
  {prop:'normalInputBox',label:'Ordinary input box',element:'el-input',placeholder:'Enter task name'},
  {prop:'numberInputBox',label:'Number input box',element:'el-input-number',placeholder:'After inputting, search will clear the data.'},
  {prop:'normalDropdown',label:'Normal drop-down',element:'el-select',options:[{label:'Query new10piece of data',value:1},{label:'The query data result is10Article',value:2}]},
  {prop:'virtualDropdown',label:'Virtual drop-down',element:'nf-virtual-select',options:[{label:'Give me some advice',value:'1'},{label:'After-sales issues',value:'2'}]},
  {prop:'opinion',label:'opinion',element:'el-input',placeholder:'Show or hide based on virtual drop-down',destory:formData=>formData.virtualDropdown!=='1'},
  {prop:'slotInput',label:'nf-tableSlot input box',slot:'slotInput'},
]
const secondFields = [...fields.filter(field=>!['opinion','slotInput'].includes(field.prop)),
  {prop:'dynamicSlot',label:'fromNfSearchFormCustom transparent transmission dynamicsslot',slot:'dynamicNfSearchFormSlot'},
  {prop:'repeatCount',label:'testnumber-range',element:'number-range',tag:'el-input',initValue:[],limitRange:[1,9999],inputSlot:{append:'repeatCountAppend',doubleAppend:'doubleRepeatCountAppend',doubleSegment:'doubleRepeatCountAppendSegment'}}]
const searchAttrs = {formOptions:fields,btnItems:['search'],columns:4,btnModel:'inline',columnEdit:true}
function useTable(key) {
  const table = ref(), rows = ref(makeRows(20)), allSelected = ref(false)
  const columns = ref([
    {type:'selection',prop:'selection',label:'Choose',attr:{width:64,fixed:'left'}},
    {prop:'id',label:'id',labelTooltip:'Configurationtips',attr:{width:90}},
    {prop:'name',label:'Task name',attr:{minWidth:160}},
    {prop:'companyName',label:()=>showStartTime.value?'Owned company(There is a date on the right)':'Owned company(No date on the right)',attr:{minWidth:190}},
    {prop:'startTime',label:'launch date',destory:()=>!showStartTime.value,attr:{minWidth:150}},
    {prop:'unit',label:'unitdata unit',unit:'%',attr:{minWidth:135}},
    {prop:'taskId',label:'optionsMapping name',options:[{label:'Task1',value:1,tagType:'success'},{label:'Task2',value:2},{label:'Task3',value:3}],attr:{minWidth:150}},
    {prop:'getOptionsId',label:'getOptionsMapping name',getOptions:done=>done([{label:'dynamic mapping1',value:1},{label:'dynamic mapping2',value:2,tagType:'tip'},{label:'dynamic mapping3',value:3}]),attr:{minWidth:190}},
    {prop:'operation',label:'Operation',attr:{fixed:'right',minWidth:210},operationSpan:3,operationList:scope=>[
      {name:'Details',onClick:row=>report('Details',row)},
      {name:'Edit',destroy:row=>row.completionRate===1,onClick:row=>report('Edit',row)},
      {name:'Voice notification',onClick:row=>report('Voice notification',row)},
      {name:'Download',destroy:true,onClick:row=>report('Download',row)},
    ]},
  ])
  const actions = reactive([
    {element:'el-checkbox',value:false,text:'Select all on this page',events:{change:()=>table.value?.toggleAllSelection()}},
    ...['turn on','pause','Delete'].map((text,i)=>({element:'el-button',text,type:i?'danger':'primary',events:{click:()=>report(text)}})),
    {element:'el-button',get text(){return showStartTime.value?'Hide launch date':'Show launch date'},get type(){return showStartTime.value?'danger':'primary'},events:{click:()=>showStartTime.value=!showStartTime.value}},
  ])
  const onSelection = selection => {
    const selected = selection.length > 0 && selection.length === table.value?.showData.length
    allSelected.value = selected; actions[0].value = selected
    result.value = 'Selected:'+selection.length
  }
  const search = ({data, callback}) => {
    try {
      if (data.numberInputBox) rows.value = []
      else if (data.normalDropdown === 1) rows.value = [...rows.value,...makeRows(10,rows.value.length)]
      else if (data.normalDropdown === 2) rows.value = makeRows(10)
      else rows.value = makeRows(20).filter(row=>row.name.includes(data.normalInputBox || ''))
      result.value = JSON.stringify(data)
    } finally { callback() }
  }
  return {table,rows,columns,actions,allSelected,onSelection,search,key}
}

const state = useTable('slots')
state.columns.value = [
 {type:'selection',prop:'selection',attr:{fixed:'left',width:64}},
 {prop:'id',label:'id',attr:{width:90}},
 {prop:'name',label:'Task name',attr:{minWidth:180}},
 {prop:'startTime',label:'launch date',labelTooltip:'Task start time',attr:{minWidth:170}},
 {prop:'operationName',label:'person in charge',slot:'operationName',attr:{minWidth:220}},
 {prop:'completionRate',label:'completion rate',headerSlot:'completionRateHeader',unit:'%',attr:{minWidth:160}},
 {prop:'operation',label:'Operation',slot:'operation',attr:{fixed:'right',width:220}},
]
const currentPage = ref(1), pageSize = ref(5)
const showRows = () => state.rows.value.slice((currentPage.value-1)*pageSize.value,currentPage.value*pageSize.value)
function getSummaries({columns,data}) {return columns.map((column,index)=>index===0?'Summary':column.property==='completionRate'?data.reduce((sum,row)=>sum+row.completionRate,0):'')}

</script>

<template>
<div class="table-examples">
<NfTable :ref="value => state.table.value = value" :data="showRows()" :columns="state.columns.value" column-edit column-position="free"
 storage-key="docs-table-slots-en" :table-attrs="{rowKey:'id',showSummary:true,summaryMethod:getSummaries}" @selection-change="state.onSelection">
 <template #columnEdit><NfButton type="primary" plain @click="state.table.value.nfColumCheckDialogVisible = true">slotDisplay and hide custom table columns</NfButton></template>
 <template #searchBox><NfSearchForm :form-options="fields" :btn-items="['search']" btn-model="inline" :columns="4" column-edit storage-key="docs-table-slot-search-en"
   @on-search="data=>{state.search({data,callback:()=>{}});currentPage=1}" >
   <template #slotInput="{formData}"><ElInput v-model="formData.slotInput" /></template>
 </NfSearchForm></template>
 <template #operationName="{row}">{{ row.operationName }} {{ row.viceOperationName }}</template>
 <template #operation="{row}"><NfButton v-for="name in ['Details','Edit','Voice']" :key="name" text @click="report(name,row)">{{ name }}</NfButton></template>
 <template #completionRateHeader><span>task completion rate</span><ElTooltip content="cumulative completion rate=（Cumulative number of imports-Number of ongoing outbound calls)/Cumulative number of imports"><ElIcon><QuestionFilled /></ElIcon></ElTooltip></template>
 <template #actionBar><ElCheckbox :model-value="state.allSelected.value" @change="state.table.value.toggleAllSelection()">Select all on this page</ElCheckbox>
  <NfButton v-for="name in ['turn on','pause','Delete']" :key="name" @click="report(name)">{{ name }}</NfButton></template>
 <template #empty>Customizedempty</template><template #append>slotCustomizedappend</template>
 <template #pagination><ElPagination v-model:current-page="currentPage" v-model:page-size="pageSize" :page-sizes="[5,10,20]" :total="state.rows.value.length" layout="total,sizes,prev,pager,next" /></template>
</NfTable>
<ElDivider>When the window is very small, the operation column and selection column are fixed with horizontal dragging.</ElDivider><ElDivider>Cooperate belownf-emptyUse</ElDivider>
<NfTable :data="[]" :columns="state.columns.value" :always-show-page="false" storage-key="docs-table-slot-empty-en">
 <template #searchBox></template><template #append>slotCustomizedappend</template><template #empty><NfEmpty :image-size="145" /></template>
</NfTable>
<output aria-live="polite">{{ result }}</output>
</div>
</template>

<style scoped>
.table-examples {max-width:100%;min-width:0}
.table-fixed {height:420px;min-height:0}
.table-examples output {display:block;margin-top:16px;overflow-wrap:anywhere}
.table-examples :deep(.el-divider__text) {max-width:90%;white-space:normal;font-size:12px}
.table-examples :deep(.el-divider--horizontal) {margin:40px 0}
.table-examples :deep(.nf-search-form-control) {max-width:100%}
.table-examples :deep(.el-form--inline) {display:flex;flex-wrap:wrap;gap:0}
@media(max-width:600px){.table-examples :deep(.nf-search-form-item){max-width:100%;margin-right:0}.table-examples :deep(.el-form-item__content){min-width:0}}
</style>
```

## Data with slots {#example-4}

### Data with slots
```vue
<script setup>
import { ref, reactive, h, onBeforeUnmount } from 'vue'
import { ElInput, ElDivider, ElCheckbox, ElPagination, ElTooltip, ElIcon, ElTableColumn, ElForm, ElFormItem } from 'element-plus'
import { QuestionFilled } from '@element-plus/icons-vue'
import { NfTable, NfSearchForm, NfButton, NfEmpty } from '@94ai-plus/common-ui'
const result = ref('')
const showStartTime = ref(false)
const report = (action, row) => result.value = action + (row ? ': ' + row.id : '')
const makeRows = (count, offset = 0) => Array.from({length:count}, (_, i) => ({
  id:offset+i+1, name:'Task'+(offset+i+1), taskId:i%3+1, companyName:'enterprise'+(i%3+1),
  operationName:'person in charge'+(i+1), viceOperationName:'collaborator'+(i+1), startTime:'2026-01-01',
  completionRate:i%2?0.6:1, unit:50+i%50, getOptionsId:i%3+1, address:'address'+(i+1)
}))
const fields = [
  {prop:'normalInputBox',label:'Ordinary input box',element:'el-input',placeholder:'Enter task name'},
  {prop:'numberInputBox',label:'Number input box',element:'el-input-number',placeholder:'After inputting, search will clear the data.'},
  {prop:'normalDropdown',label:'Normal drop-down',element:'el-select',options:[{label:'Query new10piece of data',value:1},{label:'The query data result is10Article',value:2}]},
  {prop:'virtualDropdown',label:'Virtual drop-down',element:'nf-virtual-select',options:[{label:'Give me some advice',value:'1'},{label:'After-sales issues',value:'2'}]},
  {prop:'opinion',label:'opinion',element:'el-input',placeholder:'Show or hide based on virtual drop-down',destory:formData=>formData.virtualDropdown!=='1'},
  {prop:'slotInput',label:'nf-tableSlot input box',slot:'slotInput'},
]
const secondFields = [...fields.filter(field=>!['opinion','slotInput'].includes(field.prop)),
  {prop:'dynamicSlot',label:'fromNfSearchFormCustom transparent transmission dynamicsslot',slot:'dynamicNfSearchFormSlot'},
  {prop:'repeatCount',label:'testnumber-range',element:'number-range',tag:'el-input',initValue:[],limitRange:[1,9999],inputSlot:{append:'repeatCountAppend',doubleAppend:'doubleRepeatCountAppend',doubleSegment:'doubleRepeatCountAppendSegment'}}]
const searchAttrs = {formOptions:fields,btnItems:['search'],columns:4,btnModel:'inline',columnEdit:true}
function useTable(key) {
  const table = ref(), rows = ref(makeRows(20)), allSelected = ref(false)
  const columns = ref([
    {type:'selection',prop:'selection',label:'Choose',attr:{width:64,fixed:'left'}},
    {prop:'id',label:'id',labelTooltip:'Configurationtips',attr:{width:90}},
    {prop:'name',label:'Task name',attr:{minWidth:160}},
    {prop:'companyName',label:()=>showStartTime.value?'Owned company(There is a date on the right)':'Owned company(No date on the right)',attr:{minWidth:190}},
    {prop:'startTime',label:'launch date',destory:()=>!showStartTime.value,attr:{minWidth:150}},
    {prop:'unit',label:'unitdata unit',unit:'%',attr:{minWidth:135}},
    {prop:'taskId',label:'optionsMapping name',options:[{label:'Task1',value:1,tagType:'success'},{label:'Task2',value:2},{label:'Task3',value:3}],attr:{minWidth:150}},
    {prop:'getOptionsId',label:'getOptionsMapping name',getOptions:done=>done([{label:'dynamic mapping1',value:1},{label:'dynamic mapping2',value:2,tagType:'tip'},{label:'dynamic mapping3',value:3}]),attr:{minWidth:190}},
    {prop:'operation',label:'Operation',attr:{fixed:'right',minWidth:210},operationSpan:3,operationList:scope=>[
      {name:'Details',onClick:row=>report('Details',row)},
      {name:'Edit',destroy:row=>row.completionRate===1,onClick:row=>report('Edit',row)},
      {name:'Voice notification',onClick:row=>report('Voice notification',row)},
      {name:'Download',destroy:true,onClick:row=>report('Download',row)},
    ]},
  ])
  const actions = reactive([
    {element:'el-checkbox',value:false,text:'Select all on this page',events:{change:()=>table.value?.toggleAllSelection()}},
    ...['turn on','pause','Delete'].map((text,i)=>({element:'el-button',text,type:i?'danger':'primary',events:{click:()=>report(text)}})),
    {element:'el-button',get text(){return showStartTime.value?'Hide launch date':'Show launch date'},get type(){return showStartTime.value?'danger':'primary'},events:{click:()=>showStartTime.value=!showStartTime.value}},
  ])
  const onSelection = selection => {
    const selected = selection.length > 0 && selection.length === table.value?.showData.length
    allSelected.value = selected; actions[0].value = selected
    result.value = 'Selected:'+selection.length
  }
  const search = ({data, callback}) => {
    try {
      if (data.numberInputBox) rows.value = []
      else if (data.normalDropdown === 1) rows.value = [...rows.value,...makeRows(10,rows.value.length)]
      else if (data.normalDropdown === 2) rows.value = makeRows(10)
      else rows.value = makeRows(20).filter(row=>row.name.includes(data.normalInputBox || ''))
      result.value = JSON.stringify(data)
    } finally { callback() }
  }
  return {table,rows,columns,actions,allSelected,onSelection,search,key}
}

const state = useTable('data-slot')
const formFields = secondFields

</script>

<template>
<div class="table-examples">
<NfTable :ref="value=>state.table.value=value" :data="state.rows.value" :columns="state.columns.value" column-edit
 storage-key="docs-table-data-slot-en" search-form-storage-key="docs-table-data-slot-search-en" :search-form-attrs="{...searchAttrs,formOptions:formFields}"
 :action-bar-opt-list="state.actions" :page-attrs="{pageSize:5}" :table-attrs="{rowKey:'id'}" @selection-change="state.onSelection" @search-api="state.search">
 <template #dynamicNfSearchFormSlot="{formData}"><ElInput v-model="formData.dynamicSlot" clearable /></template>
 <template #repeatCountAppend>times</template><template #doubleRepeatCountAppend>times</template><template #doubleRepeatCountAppendSegment>to</template>
 <template #slotInput="{formData}"><ElInput v-model="formData.slotInput" clearable /></template>
</NfTable>
<output aria-live="polite">{{ result }}</output>
</div>
</template>

<style scoped>
.table-examples {max-width:100%;min-width:0}
.table-fixed {height:420px;min-height:0}
.table-examples output {display:block;margin-top:16px;overflow-wrap:anywhere}
.table-examples :deep(.el-divider__text) {max-width:90%;white-space:normal;font-size:12px}
.table-examples :deep(.el-divider--horizontal) {margin:40px 0}
.table-examples :deep(.nf-search-form-control) {max-width:100%}
.table-examples :deep(.el-form--inline) {display:flex;flex-wrap:wrap;gap:0}
@media(max-width:600px){.table-examples :deep(.nf-search-form-item){max-width:100%;margin-right:0}.table-examples :deep(.el-form-item__content){min-width:0}}
</style>
```

## Bordered table and nested headers {#example-5}

### Bordered table and nested headers
```vue
<script setup>
import { ref, reactive, h, onBeforeUnmount } from 'vue'
import { ElInput, ElDivider, ElCheckbox, ElPagination, ElTooltip, ElIcon, ElTableColumn, ElForm, ElFormItem } from 'element-plus'
import { QuestionFilled } from '@element-plus/icons-vue'
import { NfTable, NfSearchForm, NfButton, NfEmpty } from '@94ai-plus/common-ui'
const result = ref('')
const showStartTime = ref(false)
const report = (action, row) => result.value = action + (row ? ': ' + row.id : '')
const makeRows = (count, offset = 0) => Array.from({length:count}, (_, i) => ({
  id:offset+i+1, name:'Task'+(offset+i+1), taskId:i%3+1, companyName:'enterprise'+(i%3+1),
  operationName:'person in charge'+(i+1), viceOperationName:'collaborator'+(i+1), startTime:'2026-01-01',
  completionRate:i%2?0.6:1, unit:50+i%50, getOptionsId:i%3+1, address:'address'+(i+1)
}))
const fields = [
  {prop:'normalInputBox',label:'Ordinary input box',element:'el-input',placeholder:'Enter task name'},
  {prop:'numberInputBox',label:'Number input box',element:'el-input-number',placeholder:'After inputting, search will clear the data.'},
  {prop:'normalDropdown',label:'Normal drop-down',element:'el-select',options:[{label:'Query new10piece of data',value:1},{label:'The query data result is10Article',value:2}]},
  {prop:'virtualDropdown',label:'Virtual drop-down',element:'nf-virtual-select',options:[{label:'Give me some advice',value:'1'},{label:'After-sales issues',value:'2'}]},
  {prop:'opinion',label:'opinion',element:'el-input',placeholder:'Show or hide based on virtual drop-down',destory:formData=>formData.virtualDropdown!=='1'},
  {prop:'slotInput',label:'nf-tableSlot input box',slot:'slotInput'},
]
const secondFields = [...fields.filter(field=>!['opinion','slotInput'].includes(field.prop)),
  {prop:'dynamicSlot',label:'fromNfSearchFormCustom transparent transmission dynamicsslot',slot:'dynamicNfSearchFormSlot'},
  {prop:'repeatCount',label:'testnumber-range',element:'number-range',tag:'el-input',initValue:[],limitRange:[1,9999],inputSlot:{append:'repeatCountAppend',doubleAppend:'doubleRepeatCountAppend',doubleSegment:'doubleRepeatCountAppendSegment'}}]
const searchAttrs = {formOptions:fields,btnItems:['search'],columns:4,btnModel:'inline',columnEdit:true}
function useTable(key) {
  const table = ref(), rows = ref(makeRows(20)), allSelected = ref(false)
  const columns = ref([
    {type:'selection',prop:'selection',label:'Choose',attr:{width:64,fixed:'left'}},
    {prop:'id',label:'id',labelTooltip:'Configurationtips',attr:{width:90}},
    {prop:'name',label:'Task name',attr:{minWidth:160}},
    {prop:'companyName',label:()=>showStartTime.value?'Owned company(There is a date on the right)':'Owned company(No date on the right)',attr:{minWidth:190}},
    {prop:'startTime',label:'launch date',destory:()=>!showStartTime.value,attr:{minWidth:150}},
    {prop:'unit',label:'unitdata unit',unit:'%',attr:{minWidth:135}},
    {prop:'taskId',label:'optionsMapping name',options:[{label:'Task1',value:1,tagType:'success'},{label:'Task2',value:2},{label:'Task3',value:3}],attr:{minWidth:150}},
    {prop:'getOptionsId',label:'getOptionsMapping name',getOptions:done=>done([{label:'dynamic mapping1',value:1},{label:'dynamic mapping2',value:2,tagType:'tip'},{label:'dynamic mapping3',value:3}]),attr:{minWidth:190}},
    {prop:'operation',label:'Operation',attr:{fixed:'right',minWidth:210},operationSpan:3,operationList:scope=>[
      {name:'Details',onClick:row=>report('Details',row)},
      {name:'Edit',destroy:row=>row.completionRate===1,onClick:row=>report('Edit',row)},
      {name:'Voice notification',onClick:row=>report('Voice notification',row)},
      {name:'Download',destroy:true,onClick:row=>report('Download',row)},
    ]},
  ])
  const actions = reactive([
    {element:'el-checkbox',value:false,text:'Select all on this page',events:{change:()=>table.value?.toggleAllSelection()}},
    ...['turn on','pause','Delete'].map((text,i)=>({element:'el-button',text,type:i?'danger':'primary',events:{click:()=>report(text)}})),
    {element:'el-button',get text(){return showStartTime.value?'Hide launch date':'Show launch date'},get type(){return showStartTime.value?'danger':'primary'},events:{click:()=>showStartTime.value=!showStartTime.value}},
  ])
  const onSelection = selection => {
    const selected = selection.length > 0 && selection.length === table.value?.showData.length
    allSelected.value = selected; actions[0].value = selected
    result.value = 'Selected:'+selection.length
  }
  const search = ({data, callback}) => {
    try {
      if (data.numberInputBox) rows.value = []
      else if (data.normalDropdown === 1) rows.value = [...rows.value,...makeRows(10,rows.value.length)]
      else if (data.normalDropdown === 2) rows.value = makeRows(10)
      else rows.value = makeRows(20).filter(row=>row.name.includes(data.normalInputBox || ''))
      result.value = JSON.stringify(data)
    } finally { callback() }
  }
  return {table,rows,columns,actions,allSelected,onSelection,search,key}
}

const state = useTable('nested')
state.columns.value.splice(2,0,{prop:'details',label:'Nested header',singleHeadMutiColSlot:'completionRateHeader'})

</script>

<template>
<div class="table-examples">
<NfTable :ref="value=>state.table.value=value" :data="state.rows.value" :columns="state.columns.value" column-edit storage-key="docs-table-nested-en"
 search-form-storage-key="docs-table-nested-search-en" :search-form-attrs="searchAttrs" :action-bar-opt-list="state.actions" :page-attrs="{pageSize:5}"
 :table-attrs="{rowKey:'id',border:true}" @selection-change="state.onSelection" @search-api="state.search">
 <template #completionRateHeader><ElTableColumn prop="name" label="Nested fields1" min-width="160" /><ElTableColumn prop="address" label="Nested fields2" min-width="160" /></template>
 <template #slotInput="{formData}"><ElInput v-model="formData.slotInput" /></template>
</NfTable>
<output aria-live="polite">{{ result }}</output>
</div>
</template>

<style scoped>
.table-examples {max-width:100%;min-width:0}
.table-fixed {height:420px;min-height:0}
.table-examples output {display:block;margin-top:16px;overflow-wrap:anywhere}
.table-examples :deep(.el-divider__text) {max-width:90%;white-space:normal;font-size:12px}
.table-examples :deep(.el-divider--horizontal) {margin:40px 0}
.table-examples :deep(.nf-search-form-control) {max-width:100%}
.table-examples :deep(.el-form--inline) {display:flex;flex-wrap:wrap;gap:0}
@media(max-width:600px){.table-examples :deep(.nf-search-form-item){max-width:100%;margin-right:0}.table-examples :deep(.el-form-item__content){min-width:0}}
</style>
```

## Sorting and filtering {#example-6}

### Sorting and filtering
```vue
<script setup>
import { ref, reactive, h, onBeforeUnmount } from 'vue'
import { ElInput, ElDivider, ElCheckbox, ElPagination, ElTooltip, ElIcon, ElTableColumn, ElForm, ElFormItem } from 'element-plus'
import { QuestionFilled } from '@element-plus/icons-vue'
import { NfTable, NfSearchForm, NfButton, NfEmpty } from '@94ai-plus/common-ui'
const result = ref('')
const showStartTime = ref(false)
const report = (action, row) => result.value = action + (row ? ': ' + row.id : '')
const makeRows = (count, offset = 0) => Array.from({length:count}, (_, i) => ({
  id:offset+i+1, name:'Task'+(offset+i+1), taskId:i%3+1, companyName:'enterprise'+(i%3+1),
  operationName:'person in charge'+(i+1), viceOperationName:'collaborator'+(i+1), startTime:'2026-01-01',
  completionRate:i%2?0.6:1, unit:50+i%50, getOptionsId:i%3+1, address:'address'+(i+1)
}))
const fields = [
  {prop:'normalInputBox',label:'Ordinary input box',element:'el-input',placeholder:'Enter task name'},
  {prop:'numberInputBox',label:'Number input box',element:'el-input-number',placeholder:'After inputting, search will clear the data.'},
  {prop:'normalDropdown',label:'Normal drop-down',element:'el-select',options:[{label:'Query new10piece of data',value:1},{label:'The query data result is10Article',value:2}]},
  {prop:'virtualDropdown',label:'Virtual drop-down',element:'nf-virtual-select',options:[{label:'Give me some advice',value:'1'},{label:'After-sales issues',value:'2'}]},
  {prop:'opinion',label:'opinion',element:'el-input',placeholder:'Show or hide based on virtual drop-down',destory:formData=>formData.virtualDropdown!=='1'},
  {prop:'slotInput',label:'nf-tableSlot input box',slot:'slotInput'},
]
const secondFields = [...fields.filter(field=>!['opinion','slotInput'].includes(field.prop)),
  {prop:'dynamicSlot',label:'fromNfSearchFormCustom transparent transmission dynamicsslot',slot:'dynamicNfSearchFormSlot'},
  {prop:'repeatCount',label:'testnumber-range',element:'number-range',tag:'el-input',initValue:[],limitRange:[1,9999],inputSlot:{append:'repeatCountAppend',doubleAppend:'doubleRepeatCountAppend',doubleSegment:'doubleRepeatCountAppendSegment'}}]
const searchAttrs = {formOptions:fields,btnItems:['search'],columns:4,btnModel:'inline',columnEdit:true}
function useTable(key) {
  const table = ref(), rows = ref(makeRows(20)), allSelected = ref(false)
  const columns = ref([
    {type:'selection',prop:'selection',label:'Choose',attr:{width:64,fixed:'left'}},
    {prop:'id',label:'id',labelTooltip:'Configurationtips',attr:{width:90}},
    {prop:'name',label:'Task name',attr:{minWidth:160}},
    {prop:'companyName',label:()=>showStartTime.value?'Owned company(There is a date on the right)':'Owned company(No date on the right)',attr:{minWidth:190}},
    {prop:'startTime',label:'launch date',destory:()=>!showStartTime.value,attr:{minWidth:150}},
    {prop:'unit',label:'unitdata unit',unit:'%',attr:{minWidth:135}},
    {prop:'taskId',label:'optionsMapping name',options:[{label:'Task1',value:1,tagType:'success'},{label:'Task2',value:2},{label:'Task3',value:3}],attr:{minWidth:150}},
    {prop:'getOptionsId',label:'getOptionsMapping name',getOptions:done=>done([{label:'dynamic mapping1',value:1},{label:'dynamic mapping2',value:2,tagType:'tip'},{label:'dynamic mapping3',value:3}]),attr:{minWidth:190}},
    {prop:'operation',label:'Operation',attr:{fixed:'right',minWidth:210},operationSpan:3,operationList:scope=>[
      {name:'Details',onClick:row=>report('Details',row)},
      {name:'Edit',destroy:row=>row.completionRate===1,onClick:row=>report('Edit',row)},
      {name:'Voice notification',onClick:row=>report('Voice notification',row)},
      {name:'Download',destroy:true,onClick:row=>report('Download',row)},
    ]},
  ])
  const actions = reactive([
    {element:'el-checkbox',value:false,text:'Select all on this page',events:{change:()=>table.value?.toggleAllSelection()}},
    ...['turn on','pause','Delete'].map((text,i)=>({element:'el-button',text,type:i?'danger':'primary',events:{click:()=>report(text)}})),
    {element:'el-button',get text(){return showStartTime.value?'Hide launch date':'Show launch date'},get type(){return showStartTime.value?'danger':'primary'},events:{click:()=>showStartTime.value=!showStartTime.value}},
  ])
  const onSelection = selection => {
    const selected = selection.length > 0 && selection.length === table.value?.showData.length
    allSelected.value = selected; actions[0].value = selected
    result.value = 'Selected:'+selection.length
  }
  const search = ({data, callback}) => {
    try {
      if (data.numberInputBox) rows.value = []
      else if (data.normalDropdown === 1) rows.value = [...rows.value,...makeRows(10,rows.value.length)]
      else if (data.normalDropdown === 2) rows.value = makeRows(10)
      else rows.value = makeRows(20).filter(row=>row.name.includes(data.normalInputBox || ''))
      result.value = JSON.stringify(data)
    } finally { callback() }
  }
  return {table,rows,columns,actions,allSelected,onSelection,search,key}
}

const state = useTable('filter')
Object.assign(state.columns.value[1].attr,{sortable:true,columnKey:'id',filters:[{text:'>3',value:3},{text:'>10',value:10}],filterMultiple:false,filterMethod:(value,row)=>row.id>value})

</script>

<template>
<div class="table-examples">
<NfTable :ref="value=>state.table.value=value" :data="state.rows.value" :columns="state.columns.value" column-edit storage-key="docs-table-filter-en"
 search-form-storage-key="docs-table-filter-search-en" :search-form-attrs="searchAttrs" :action-bar-opt-list="state.actions" :page-attrs="{pageSize:20}"
 :table-attrs="{rowKey:'id',defaultSort:{prop:'id',order:'descending'}}" @selection-change="state.onSelection" @search-api="state.search"
 @sort-change="value=>result=JSON.stringify({sort:value.prop,order:value.order})" @filter-change="value=>result=JSON.stringify(value)">
 <template #slotInput="{formData}"><ElInput v-model="formData.slotInput" /></template>
</NfTable>
<output aria-live="polite">{{ result }}</output>
</div>
</template>

<style scoped>
.table-examples {max-width:100%;min-width:0}
.table-fixed {height:420px;min-height:0}
.table-examples output {display:block;margin-top:16px;overflow-wrap:anywhere}
.table-examples :deep(.el-divider__text) {max-width:90%;white-space:normal;font-size:12px}
.table-examples :deep(.el-divider--horizontal) {margin:40px 0}
.table-examples :deep(.nf-search-form-control) {max-width:100%}
.table-examples :deep(.el-form--inline) {display:flex;flex-wrap:wrap;gap:0}
@media(max-width:600px){.table-examples :deep(.nf-search-form-item){max-width:100%;margin-right:0}.table-examples :deep(.el-form-item__content){min-width:0}}
</style>
```

<span id="tree"></span>

## Expandable rows and tree data {#example-7}

### Expandable rows and tree data
```vue
<script setup>
import { ref, reactive, h, onBeforeUnmount } from 'vue'
import { ElInput, ElDivider, ElCheckbox, ElPagination, ElTooltip, ElIcon, ElTableColumn, ElForm, ElFormItem } from 'element-plus'
import { QuestionFilled } from '@element-plus/icons-vue'
import { NfTable, NfSearchForm, NfButton, NfEmpty } from '@94ai-plus/common-ui'
const result = ref('')
const showStartTime = ref(false)
const report = (action, row) => result.value = action + (row ? ': ' + row.id : '')
const makeRows = (count, offset = 0) => Array.from({length:count}, (_, i) => ({
  id:offset+i+1, name:'Task'+(offset+i+1), taskId:i%3+1, companyName:'enterprise'+(i%3+1),
  operationName:'person in charge'+(i+1), viceOperationName:'collaborator'+(i+1), startTime:'2026-01-01',
  completionRate:i%2?0.6:1, unit:50+i%50, getOptionsId:i%3+1, address:'address'+(i+1)
}))
const fields = [
  {prop:'normalInputBox',label:'Ordinary input box',element:'el-input',placeholder:'Enter task name'},
  {prop:'numberInputBox',label:'Number input box',element:'el-input-number',placeholder:'After inputting, search will clear the data.'},
  {prop:'normalDropdown',label:'Normal drop-down',element:'el-select',options:[{label:'Query new10piece of data',value:1},{label:'The query data result is10Article',value:2}]},
  {prop:'virtualDropdown',label:'Virtual drop-down',element:'nf-virtual-select',options:[{label:'Give me some advice',value:'1'},{label:'After-sales issues',value:'2'}]},
  {prop:'opinion',label:'opinion',element:'el-input',placeholder:'Show or hide based on virtual drop-down',destory:formData=>formData.virtualDropdown!=='1'},
  {prop:'slotInput',label:'nf-tableSlot input box',slot:'slotInput'},
]
const secondFields = [...fields.filter(field=>!['opinion','slotInput'].includes(field.prop)),
  {prop:'dynamicSlot',label:'fromNfSearchFormCustom transparent transmission dynamicsslot',slot:'dynamicNfSearchFormSlot'},
  {prop:'repeatCount',label:'testnumber-range',element:'number-range',tag:'el-input',initValue:[],limitRange:[1,9999],inputSlot:{append:'repeatCountAppend',doubleAppend:'doubleRepeatCountAppend',doubleSegment:'doubleRepeatCountAppendSegment'}}]
const searchAttrs = {formOptions:fields,btnItems:['search'],columns:4,btnModel:'inline',columnEdit:true}
function useTable(key) {
  const table = ref(), rows = ref(makeRows(20)), allSelected = ref(false)
  const columns = ref([
    {type:'selection',prop:'selection',label:'Choose',attr:{width:64,fixed:'left'}},
    {prop:'id',label:'id',labelTooltip:'Configurationtips',attr:{width:90}},
    {prop:'name',label:'Task name',attr:{minWidth:160}},
    {prop:'companyName',label:()=>showStartTime.value?'Owned company(There is a date on the right)':'Owned company(No date on the right)',attr:{minWidth:190}},
    {prop:'startTime',label:'launch date',destory:()=>!showStartTime.value,attr:{minWidth:150}},
    {prop:'unit',label:'unitdata unit',unit:'%',attr:{minWidth:135}},
    {prop:'taskId',label:'optionsMapping name',options:[{label:'Task1',value:1,tagType:'success'},{label:'Task2',value:2},{label:'Task3',value:3}],attr:{minWidth:150}},
    {prop:'getOptionsId',label:'getOptionsMapping name',getOptions:done=>done([{label:'dynamic mapping1',value:1},{label:'dynamic mapping2',value:2,tagType:'tip'},{label:'dynamic mapping3',value:3}]),attr:{minWidth:190}},
    {prop:'operation',label:'Operation',attr:{fixed:'right',minWidth:210},operationSpan:3,operationList:scope=>[
      {name:'Details',onClick:row=>report('Details',row)},
      {name:'Edit',destroy:row=>row.completionRate===1,onClick:row=>report('Edit',row)},
      {name:'Voice notification',onClick:row=>report('Voice notification',row)},
      {name:'Download',destroy:true,onClick:row=>report('Download',row)},
    ]},
  ])
  const actions = reactive([
    {element:'el-checkbox',value:false,text:'Select all on this page',events:{change:()=>table.value?.toggleAllSelection()}},
    ...['turn on','pause','Delete'].map((text,i)=>({element:'el-button',text,type:i?'danger':'primary',events:{click:()=>report(text)}})),
    {element:'el-button',get text(){return showStartTime.value?'Hide launch date':'Show launch date'},get type(){return showStartTime.value?'danger':'primary'},events:{click:()=>showStartTime.value=!showStartTime.value}},
  ])
  const onSelection = selection => {
    const selected = selection.length > 0 && selection.length === table.value?.showData.length
    allSelected.value = selected; actions[0].value = selected
    result.value = 'Selected:'+selection.length
  }
  const search = ({data, callback}) => {
    try {
      if (data.numberInputBox) rows.value = []
      else if (data.normalDropdown === 1) rows.value = [...rows.value,...makeRows(10,rows.value.length)]
      else if (data.normalDropdown === 2) rows.value = makeRows(10)
      else rows.value = makeRows(20).filter(row=>row.name.includes(data.normalInputBox || ''))
      result.value = JSON.stringify(data)
    } finally { callback() }
  }
  return {table,rows,columns,actions,allSelected,onSelection,search,key}
}

const expanded = useTable('expand'), tree = useTable('tree')
expanded.columns.value.unshift({type:'expand',prop:'expand',slot:'expandSlot'})
tree.columns.value.splice(1,0,{prop:'name',label:'Task name',attr:{minWidth:200}})
tree.rows.value = makeRows(5).map((row,i)=>({...row,children:makeRows(2,100+i*2)}))

</script>

<template>
<div class="table-examples">
<NfTable :ref="value=>expanded.table.value=value" :data="expanded.rows.value" :columns="expanded.columns.value" column-edit storage-key="docs-table-expand-en"
 search-form-storage-key="docs-table-expand-search-en" :search-form-attrs="searchAttrs" :page-attrs="{pageSize:5}" :table-attrs="{rowKey:'id'}" @search-api="expanded.search">
 <template #slotInput="{formData}"><ElInput v-model="formData.slotInput" /></template>
 <template #expandSlot="{row}"><ElForm label-position="left" label-width="100px">
  <ElFormItem v-for="field in [{prop:'id',label:'id'},{prop:'taskId',label:'No.'},{prop:'name',label:'Task name'},{prop:'companyName',label:'Owned company'},{prop:'startTime',label:'launch date'},{prop:'completionRate',label:'completion rate'},{prop:'operationName',label:'person in charge'}]" :key="field.prop" :label="field.label">{{ row[field.prop] }}</ElFormItem>
  <ElFormItem label="and more">xxxx</ElFormItem>
 </ElForm></template>
</NfTable><ElDivider>Expand row above</ElDivider><ElDivider>The tree form below</ElDivider>
<NfTable :ref="value=>tree.table.value=value" :data="tree.rows.value" :columns="tree.columns.value" column-edit storage-key="docs-table-tree-en"
 search-form-storage-key="docs-table-tree-search-en" :search-form-attrs="searchAttrs" :table-attrs="{rowKey:'id',treeProps:{children:'children'}}" :page-attrs="{pageSize:5}" :action-bar-opt-list="tree.actions" @selection-change="tree.onSelection">
 <template #slotInput="{formData}"><ElInput v-model="formData.slotInput" /></template>
</NfTable>
<output aria-live="polite">{{ result }}</output>
</div>
</template>

<style scoped>
.table-examples {max-width:100%;min-width:0}
.table-fixed {height:420px;min-height:0}
.table-examples output {display:block;margin-top:16px;overflow-wrap:anywhere}
.table-examples :deep(.el-divider__text) {max-width:90%;white-space:normal;font-size:12px}
.table-examples :deep(.el-divider--horizontal) {margin:40px 0}
.table-examples :deep(.nf-search-form-control) {max-width:100%}
.table-examples :deep(.el-form--inline) {display:flex;flex-wrap:wrap;gap:0}
@media(max-width:600px){.table-examples :deep(.nf-search-form-item){max-width:100%;margin-right:0}.table-examples :deep(.el-form-item__content){min-width:0}}
</style>
```

<span id="virtual"></span>

## Virtual table without pagination {#example-8}

### Virtual table without pagination
```vue
<script setup>
import { ref, reactive, h, onBeforeUnmount } from 'vue'
import { ElInput, ElDivider, ElCheckbox, ElPagination, ElTooltip, ElIcon, ElTableColumn, ElForm, ElFormItem } from 'element-plus'
import { QuestionFilled } from '@element-plus/icons-vue'
import { NfTable, NfSearchForm, NfButton, NfEmpty } from '@94ai-plus/common-ui'
const result = ref('')
const showStartTime = ref(false)
const report = (action, row) => result.value = action + (row ? ': ' + row.id : '')
const makeRows = (count, offset = 0) => Array.from({length:count}, (_, i) => ({
  id:offset+i+1, name:'Task'+(offset+i+1), taskId:i%3+1, companyName:'enterprise'+(i%3+1),
  operationName:'person in charge'+(i+1), viceOperationName:'collaborator'+(i+1), startTime:'2026-01-01',
  completionRate:i%2?0.6:1, unit:50+i%50, getOptionsId:i%3+1, address:'address'+(i+1)
}))
const fields = [
  {prop:'normalInputBox',label:'Ordinary input box',element:'el-input',placeholder:'Enter task name'},
  {prop:'numberInputBox',label:'Number input box',element:'el-input-number',placeholder:'After inputting, search will clear the data.'},
  {prop:'normalDropdown',label:'Normal drop-down',element:'el-select',options:[{label:'Query new10piece of data',value:1},{label:'The query data result is10Article',value:2}]},
  {prop:'virtualDropdown',label:'Virtual drop-down',element:'nf-virtual-select',options:[{label:'Give me some advice',value:'1'},{label:'After-sales issues',value:'2'}]},
  {prop:'opinion',label:'opinion',element:'el-input',placeholder:'Show or hide based on virtual drop-down',destory:formData=>formData.virtualDropdown!=='1'},
  {prop:'slotInput',label:'nf-tableSlot input box',slot:'slotInput'},
]
const secondFields = [...fields.filter(field=>!['opinion','slotInput'].includes(field.prop)),
  {prop:'dynamicSlot',label:'fromNfSearchFormCustom transparent transmission dynamicsslot',slot:'dynamicNfSearchFormSlot'},
  {prop:'repeatCount',label:'testnumber-range',element:'number-range',tag:'el-input',initValue:[],limitRange:[1,9999],inputSlot:{append:'repeatCountAppend',doubleAppend:'doubleRepeatCountAppend',doubleSegment:'doubleRepeatCountAppendSegment'}}]
const searchAttrs = {formOptions:fields,btnItems:['search'],columns:4,btnModel:'inline',columnEdit:true}
function useTable(key) {
  const table = ref(), rows = ref(makeRows(20)), allSelected = ref(false)
  const columns = ref([
    {type:'selection',prop:'selection',label:'Choose',attr:{width:64,fixed:'left'}},
    {prop:'id',label:'id',labelTooltip:'Configurationtips',attr:{width:90}},
    {prop:'name',label:'Task name',attr:{minWidth:160}},
    {prop:'companyName',label:()=>showStartTime.value?'Owned company(There is a date on the right)':'Owned company(No date on the right)',attr:{minWidth:190}},
    {prop:'startTime',label:'launch date',destory:()=>!showStartTime.value,attr:{minWidth:150}},
    {prop:'unit',label:'unitdata unit',unit:'%',attr:{minWidth:135}},
    {prop:'taskId',label:'optionsMapping name',options:[{label:'Task1',value:1,tagType:'success'},{label:'Task2',value:2},{label:'Task3',value:3}],attr:{minWidth:150}},
    {prop:'getOptionsId',label:'getOptionsMapping name',getOptions:done=>done([{label:'dynamic mapping1',value:1},{label:'dynamic mapping2',value:2,tagType:'tip'},{label:'dynamic mapping3',value:3}]),attr:{minWidth:190}},
    {prop:'operation',label:'Operation',attr:{fixed:'right',minWidth:210},operationSpan:3,operationList:scope=>[
      {name:'Details',onClick:row=>report('Details',row)},
      {name:'Edit',destroy:row=>row.completionRate===1,onClick:row=>report('Edit',row)},
      {name:'Voice notification',onClick:row=>report('Voice notification',row)},
      {name:'Download',destroy:true,onClick:row=>report('Download',row)},
    ]},
  ])
  const actions = reactive([
    {element:'el-checkbox',value:false,text:'Select all on this page',events:{change:()=>table.value?.toggleAllSelection()}},
    ...['turn on','pause','Delete'].map((text,i)=>({element:'el-button',text,type:i?'danger':'primary',events:{click:()=>report(text)}})),
    {element:'el-button',get text(){return showStartTime.value?'Hide launch date':'Show launch date'},get type(){return showStartTime.value?'danger':'primary'},events:{click:()=>showStartTime.value=!showStartTime.value}},
  ])
  const onSelection = selection => {
    const selected = selection.length > 0 && selection.length === table.value?.showData.length
    allSelected.value = selected; actions[0].value = selected
    result.value = 'Selected:'+selection.length
  }
  const search = ({data, callback}) => {
    try {
      if (data.numberInputBox) rows.value = []
      else if (data.normalDropdown === 1) rows.value = [...rows.value,...makeRows(10,rows.value.length)]
      else if (data.normalDropdown === 2) rows.value = makeRows(10)
      else rows.value = makeRows(20).filter(row=>row.name.includes(data.normalInputBox || ''))
      result.value = JSON.stringify(data)
    } finally { callback() }
  }
  return {table,rows,columns,actions,allSelected,onSelection,search,key}
}

const table = ref(), selected = ref(0), all = ref(false)
const makeData = count => makeRows(count).map(row=>({...row,age:18+row.id%48,email:'user'+row.id+'@example.com',registerDate:'2026-01-01'}))
const rows = ref(makeData(1500))
const columns = [{type:'selection',prop:'selection',attr:{width:60}},...['id','name','age','email','address','registerDate'].map((prop,i)=>({prop,label:['id','name','age','Mail','address','time'][i],attr:{minWidth:120}})),{prop:'operation',label:'Operation',slot:'operation',attr:{fixed:'right',width:140}}]

</script>

<template>
<div class="table-examples">
<NfTable ref="table" :data="rows" :columns="columns" column-edit storage-key="docs-table-virtual-en" :virtualized="rows.length>100" :virtual-table-data="rows" :always-show-page="false"
 :virtual-props="{rowHeight:70,height:500}" :table-attrs="{rowKey:'id',maxHeight:500}" @selection-change="value=>{selected=value.length;all=value.length===rows.length}">
 <template #actionBar><ElCheckbox :model-value="all" @change="value=>value?table.toggleAllSelection():table.clearSelection()">All</ElCheckbox><span>Selected:{{ selected }}</span></template>
 <template #operation="{row,index}"><NfButton text size="mini" @click="result=JSON.stringify({row,index})">Print line information</NfButton></template>
</NfTable><div style="display:flex;gap:12px;margin-top:16px"><NfButton @click="rows=makeData(50);table.clearSelection()">50Article</NfButton><NfButton @click="rows=makeData(1500);table.clearSelection()">1500Article</NfButton></div>
<output aria-live="polite">{{ result }}</output>
</div>
</template>

<style scoped>
.table-examples {max-width:100%;min-width:0}
.table-fixed {height:420px;min-height:0}
.table-examples output {display:block;margin-top:16px;overflow-wrap:anywhere}
.table-examples :deep(.el-divider__text) {max-width:90%;white-space:normal;font-size:12px}
.table-examples :deep(.el-divider--horizontal) {margin:40px 0}
.table-examples :deep(.nf-search-form-control) {max-width:100%}
.table-examples :deep(.el-form--inline) {display:flex;flex-wrap:wrap;gap:0}
@media(max-width:600px){.table-examples :deep(.nf-search-form-item){max-width:100%;margin-right:0}.table-examples :deep(.el-form-item__content){min-width:0}}
</style>
```

## Fixed-right action column resizing and indicator bounds {#example-9}

### Fixed-right action column resizing and indicator bounds
```vue
<script setup>
import { ref, reactive, h, onBeforeUnmount } from 'vue'
import { ElInput, ElDivider, ElCheckbox, ElPagination, ElTooltip, ElIcon, ElTableColumn, ElForm, ElFormItem } from 'element-plus'
import { QuestionFilled } from '@element-plus/icons-vue'
import { NfTable, NfSearchForm, NfButton, NfEmpty } from '@94ai-plus/common-ui'
const result = ref('')
const showStartTime = ref(false)
const report = (action, row) => result.value = action + (row ? ': ' + row.id : '')
const makeRows = (count, offset = 0) => Array.from({length:count}, (_, i) => ({
  id:offset+i+1, name:'Task'+(offset+i+1), taskId:i%3+1, companyName:'enterprise'+(i%3+1),
  operationName:'person in charge'+(i+1), viceOperationName:'collaborator'+(i+1), startTime:'2026-01-01',
  completionRate:i%2?0.6:1, unit:50+i%50, getOptionsId:i%3+1, address:'address'+(i+1)
}))
const fields = [
  {prop:'normalInputBox',label:'Ordinary input box',element:'el-input',placeholder:'Enter task name'},
  {prop:'numberInputBox',label:'Number input box',element:'el-input-number',placeholder:'After inputting, search will clear the data.'},
  {prop:'normalDropdown',label:'Normal drop-down',element:'el-select',options:[{label:'Query new10piece of data',value:1},{label:'The query data result is10Article',value:2}]},
  {prop:'virtualDropdown',label:'Virtual drop-down',element:'nf-virtual-select',options:[{label:'Give me some advice',value:'1'},{label:'After-sales issues',value:'2'}]},
  {prop:'opinion',label:'opinion',element:'el-input',placeholder:'Show or hide based on virtual drop-down',destory:formData=>formData.virtualDropdown!=='1'},
  {prop:'slotInput',label:'nf-tableSlot input box',slot:'slotInput'},
]
const secondFields = [...fields.filter(field=>!['opinion','slotInput'].includes(field.prop)),
  {prop:'dynamicSlot',label:'fromNfSearchFormCustom transparent transmission dynamicsslot',slot:'dynamicNfSearchFormSlot'},
  {prop:'repeatCount',label:'testnumber-range',element:'number-range',tag:'el-input',initValue:[],limitRange:[1,9999],inputSlot:{append:'repeatCountAppend',doubleAppend:'doubleRepeatCountAppend',doubleSegment:'doubleRepeatCountAppendSegment'}}]
const searchAttrs = {formOptions:fields,btnItems:['search'],columns:4,btnModel:'inline',columnEdit:true}
function useTable(key) {
  const table = ref(), rows = ref(makeRows(20)), allSelected = ref(false)
  const columns = ref([
    {type:'selection',prop:'selection',label:'Choose',attr:{width:64,fixed:'left'}},
    {prop:'id',label:'id',labelTooltip:'Configurationtips',attr:{width:90}},
    {prop:'name',label:'Task name',attr:{minWidth:160}},
    {prop:'companyName',label:()=>showStartTime.value?'Owned company(There is a date on the right)':'Owned company(No date on the right)',attr:{minWidth:190}},
    {prop:'startTime',label:'launch date',destory:()=>!showStartTime.value,attr:{minWidth:150}},
    {prop:'unit',label:'unitdata unit',unit:'%',attr:{minWidth:135}},
    {prop:'taskId',label:'optionsMapping name',options:[{label:'Task1',value:1,tagType:'success'},{label:'Task2',value:2},{label:'Task3',value:3}],attr:{minWidth:150}},
    {prop:'getOptionsId',label:'getOptionsMapping name',getOptions:done=>done([{label:'dynamic mapping1',value:1},{label:'dynamic mapping2',value:2,tagType:'tip'},{label:'dynamic mapping3',value:3}]),attr:{minWidth:190}},
    {prop:'operation',label:'Operation',attr:{fixed:'right',minWidth:210},operationSpan:3,operationList:scope=>[
      {name:'Details',onClick:row=>report('Details',row)},
      {name:'Edit',destroy:row=>row.completionRate===1,onClick:row=>report('Edit',row)},
      {name:'Voice notification',onClick:row=>report('Voice notification',row)},
      {name:'Download',destroy:true,onClick:row=>report('Download',row)},
    ]},
  ])
  const actions = reactive([
    {element:'el-checkbox',value:false,text:'Select all on this page',events:{change:()=>table.value?.toggleAllSelection()}},
    ...['turn on','pause','Delete'].map((text,i)=>({element:'el-button',text,type:i?'danger':'primary',events:{click:()=>report(text)}})),
    {element:'el-button',get text(){return showStartTime.value?'Hide launch date':'Show launch date'},get type(){return showStartTime.value?'danger':'primary'},events:{click:()=>showStartTime.value=!showStartTime.value}},
  ])
  const onSelection = selection => {
    const selected = selection.length > 0 && selection.length === table.value?.showData.length
    allSelected.value = selected; actions[0].value = selected
    result.value = 'Selected:'+selection.length
  }
  const search = ({data, callback}) => {
    try {
      if (data.numberInputBox) rows.value = []
      else if (data.normalDropdown === 1) rows.value = [...rows.value,...makeRows(10,rows.value.length)]
      else if (data.normalDropdown === 2) rows.value = makeRows(10)
      else rows.value = makeRows(20).filter(row=>row.name.includes(data.normalInputBox || ''))
      result.value = JSON.stringify(data)
    } finally { callback() }
  }
  return {table,rows,columns,actions,allSelected,onSelection,search,key}
}

const rows = [{id:1,name:'Alice',status:1},{id:2,name:'Bob',status:0}]
const columns = ref([{prop:'id',label:'ID',attr:{width:100}},{prop:'name',label:'name',attr:{minWidth:120}},{prop:'operation',label:'Operation',operationSpan:0,attr:{fixed:'right',width:160},operationList:[{name:'Edit',key:'edit',onClick:row=>report('Edit',row)},{name:'Delete',key:'del',type:'danger',onClick:row=>report('Delete',row)}]}])
function onFixedDragEnd({width,oldWidth,prop}) {columns.value[2].attr.width=width;result.value=JSON.stringify({width,oldWidth,prop})}

</script>

<template>
<div class="table-examples">
<div style="height:480px"><NfTable :data="rows" :columns="columns" cal-height column-edit storage-key="docs-table-fixed-drag-en"
 fixed-right-drag-enabled :drag-indicator-padding-left="170" :drag-indicator-padding-right="170" @fixed-column-drag-end="onFixedDragEnd" /></div>
<output aria-live="polite">{{ result }}</output>
</div>
</template>

<style scoped>
.table-examples {max-width:100%;min-width:0}
.table-fixed {height:420px;min-height:0}
.table-examples output {display:block;margin-top:16px;overflow-wrap:anywhere}
.table-examples :deep(.el-divider__text) {max-width:90%;white-space:normal;font-size:12px}
.table-examples :deep(.el-divider--horizontal) {margin:40px 0}
.table-examples :deep(.nf-search-form-control) {max-width:100%}
.table-examples :deep(.el-form--inline) {display:flex;flex-wrap:wrap;gap:0}
@media(max-width:600px){.table-examples :deep(.nf-search-form-item){max-width:100%;margin-right:0}.table-examples :deep(.el-form-item__content){min-width:0}}
</style>
```

## NfTableColumnAttributes {#column-options}

| parameters | Description | Type |
| --- | --- | --- |
| key | Unique identifier for the column; not set prop used as a fallback identifier. | string / number |
| prop | Column field path. | string |
| type | Select a column, ordinal column, or expand a column. | selection / index / expand |
| label | Column header, also returned by the function. | string / Function |
| attr | Element Plus TableColumn public properties. | ElTableColumnAttributes |
| slot | Cell named slot. | string |
| headerSlot | Header named slot. | string |
| singleHeadMutiColSlot | TableColumn slots are nested under a single table header. | string |
| children | Nested header column definitions. | NfTableColumnAttributes[] |
| render | Customize cells using Vue 3h or VNode. | (row, scope) =&gt; VNodeChild |
| labelTooltip / labelTooltipPlacement | Header prompts and location. | string |
| unit | Data unit suffix. | string |
| options / getOptions | Static or asynchronous enum mapping; option supports tagType. | array / Function |
| optionsEnum / optionsTag | Mapping of values to text, label types. | object |
| operationList | A function that operates on a button configuration or returns a configuration by row. | array / Function |
| operationSpan | Collapse when the number of action buttons exceeds the specified number; 0 by width. | number |
| initHidden | The initial hidden state of the column. | boolean |
| destroy / destory / show | Control column display by configuration. | boolean / Function |
| fit.tags | Tags involved in content width estimation. | string[] |

## Attribute {#props}

| parameters | Description | Type | Optional value | Default value |
| --- | --- | --- | --- | --- |
| data | Populate table data | Record&lt;string, any&gt;[] | — | [] |
| columns | Render table header json data | NfTableColumnAttributes[] | — | [] |
| searchFormAttrs | Form attributes, the same as nf-search-form Attributes attributes | NfSearchFormAttributes | — | {} |
| pageAttrs | Pagination properties. Omitting total uses front-end paging; passing total uses server-side paging, and the business party returns the current page data according to the request. | ElPaginationAttributes | — | {} |
| tableAttrs | Table attributes, transparent transmission Element Plus Table public properties. | ElTableAttributes | — | {} |
| searchFormEvents | Form events are consistent with nf-search-form component Events | Partial&lt;Record&lt;NfSearchFormEventKey, Function&gt;&gt; | — | {} |
| pageEvents | Pagination events are consistent with el-pagination component Events | Partial&lt;Record&lt;ElPaginationEventKey, Function&gt;&gt; | — | {} |
| tableEvents | Table events are consistent with el-table component Table Events | Partial&lt;Record&lt;ElTableEventKey, Function&gt;&gt; | — | {} |
| actionBarOptList | actionBar button renders json data | NfTableActionBtnAttributes[] | — | [] |
| operationPropKey | Data-driven rendering of cell operation buttons, the prop value of the specified cell is defined as the key of the button operation column | string | — | 'operation' |
| alwaysShowPage | Whether to always display pagination; virtual tables do not display pagination. | boolean | — | true |
| calHeight | The fixed window fills the screen (or fills the parent container) and the table automatically calculates the height, which is used to implement fixed-height content scrolling of a window table (content is limited to height and self-scrolling). This is a relatively good table interaction effect. | boolean | — | false |
| dragCached | Whether to cache column drag width, use IndexedDB. | boolean | — | true |
| dragIndicatorPaddingLeft | Fixed the minimum distance (px) between the right column drag indicator line and the left side | number | — | 120 |
| dragIndicatorPaddingRight | Fixed the minimum distance (px) between the right column drag indicator line and the right side | number | — | 120 |
| fixedRightDragEnabled | Whether to enable the custom drag handle fixed to the right operation column | boolean | — | false |
| emptyImageSize | Table empty data spatio-temporal component size | number | — | 145 |
| initSearchApi | Whether to automatically query during initialization; follow setEasyConf if not passed. | boolean | If you don’t pass it on, you will follow it.setEasyConf | undefined |
| pageChangeSearchApi | Whether paging changes are automatically queried; if not passed, follow setEasyConf. | boolean | If you don’t pass it on, you will follow it.setEasyConf | undefined |
| pageKeys | Fields used for pagination | string[] | - | ['pageNo', 'pageSize'] |
| setEasyConf | Enable simple configuration and provide initialization query, paging query, search layout and row-key default value. Explicit settings take precedence. | boolean | Please check | false |
| loadingFunction |  |  |  |  |
| loading | Table loading | boolean | — | false |
| target | Loading DOM nodes that need to be covered. A DOM object or string can be passed in; if a string is passed in, it will be passed into document.querySelector as a parameter to obtain the corresponding DOM node. | HTMLElement | — | undefined |
| body | Same as body modifier in v-loading directive | boolean | — | false |
| fullscreen | Same as fullscreen modifier in v-loading directive | boolean | — | false |
| lock | Same as the lock modifier in the v-loading directive | boolean | — | false |
| text | Loading Loading text displayed below the loading icon | string | — | undefined |
| spinner | Loading custom loading icon class name | string | — | undefined |
| background | Loading mask background color | string | — | undefined |
| customClass | Custom class name for Loading | string | — | undefined |
| columnEdit | Column editing function switch. | boolean | — | false |
| columnPosition | Column edit button position | string | free/embed | 'embed' |
| showColumn | Column editing initializes the table item field prop collection to be displayed. [] represents displaying all, and can be used in conjunction with initHidden of columns. | string[] | — | undefined |
| priority | Column editing cache echo priority, handles the echo relationship between item.initHidden, form.showColumn and IndexedDB.cache | string | cached/value | 'cached' |
| storageKey | The IndexedDB cache key set by the table column; multiple instances of the same page should use independent keys. | string | - | `nf-table-columns-cached-key-${routeName}` |
| searchFormStorageKey | Optional, the meaning is the same as storageKey. nfSearchForm sets the field cache key. You can also set storageKey in searchFormAttrs. | string | - | `nf-search-form-columns-cached-key-${routeName}` |
| checkMode | Optional, column editing interactive mode, default drawer (drawer/dialog) | string | dialog/drawer | 'drawer' |
| columnDisplayBtnClass | Column edit button class name | string | — | '' |
| columnDisplayBtnIcon | Column edit button icon | string | — | undefined |
| columnDisplayBtnType | Column edit button type | string | — | 'primary' |
| columnDisplayBtnPlain | Column edit button hollow | boolean | — | true |
| columnDisplayBtnSize | Column edit button size | string | — | 'mini' |
| columnDisplayBtnRound | Column edit button rounded corners | boolean | — | false |
| columnDisplayBtnCircle | Column edit button circle | boolean | — | false |
| columnDisplayBtnLoading | Column edit button Loading | boolean | — | false |
| columnDisplayBtnDisabled | Column edit button disabled | boolean | — | false |
| columnDisplayBtnText | Column edit button text | string | — | Follow language pack |
| columnCheckTitle | Column editing dialog/drawer mode-&gt;pop-up box title | string | - | Set display fields |
| columnCheckCancelButtonText | Column edit dialog/drawer mode cancel button text | string | - | 'Cancel' |
| columnCheckConfirmButtonText | Column editing dialog/drawer mode determine button text | string | - | 'OK' |
| columnCheckBasicFieldDesc | Default category title | string | - | Follow language pack |
| columnCheckWidth | Column editing dialog mode-&gt;pop-up box width | string | - | '600px' |
| columnCheckModalAppendToBody | Column editing dialog mode-&gt;pop-up mask layer appendToBody | boolean | - | true |
| columnCheckModal | Column editing dialog mode -&gt; Whether the pop-up box displays the mask layer | boolean | - | true |
| columnCheckFullscreen | Column editing dialog mode -&gt; whether the pop-up box is full screen | boolean | - | false |
| columnCheckTop | Column editing dialog mode-&gt;pop-up box Top | string | - | '15vh' |
| columnCheckAppendToBody | Column editing dialog mode-&gt;pop-up box appendToBody | boolean | - | false |
| columnCheckLockScroll | Column editing dialog mode-&gt;Pop-up LockScroll | boolean | - | true |
| columnCheckCustomClass | Column editing dialog mode-&gt;pop-up box CustomClass | string | - | '' |
| columnCheckCloseOnlickModal | Column editing dialog mode-&gt;pop-up box CloseOnlickModal | boolean | - | true |
| columnCheckCloseOnPressEscape | Column editing dialog mode-&gt;pop-up box CloseOnPressEscape | boolean | - | true |
| columnCheckShowClose | Column editing dialog mode-&gt;pop-up box title ShowClose | boolean | - | true |
| columnCheckBeforeClose | Column editing dialog mode-&gt;pop-up box beforeClose | Function | - | undefined |
| columnCheckCenter | Column editing dialog mode -&gt; whether the pop-up box is centered | boolean | - | false |
| columnCheckDestroyOnClose | Column editing dialog mode -&gt; popup box destruction whether to delete the sub-dom | boolean | - | false |
| columnCheckTabs | Column editing drawer mode-&gt;tab data | ITabItem[] | - | - |
| columnCheckCurrentTab | Column editing drawer mode-&gt;Currently displayed tab name | string | - | - |
| selectEmptyWarningTips | Prompt when the column editing setting field is not empty | string | - | Please select at least one option |
| columnCheckSearchPlaceholder | Column editing drawer mode-&gt;search box placeholder | string | - | 'Search' |
| columnCheckFixedLeftDesc | Column editing drawer mode -&gt; fixed to left description | string | - | Follow language pack |
| columnCheckClearDesc | Column editing drawer mode -&gt; clear description | string | - | Follow language pack |
| columnCheckNoFixedDesc | Column editing drawer mode -&gt; Unfixed description | string | - | Follow language pack |
| columnCheckGetCheckedLengthDesc | Column editing drawer mode-&gt;selected description | (length) =&gt; string | - | (length) =&gt; 'selected (' + length + '）' |
| columnCheckGetAllCheckDesc | Column editing drawer mode-&gt;select all description | (length) =&gt; string | - | (length) =&gt; 'Select all (' + length + '） |
| virtualized | Enables virtual scrolling with fixed row height. | boolean | — | false |
| virtualTableData | Virtual table complete data source; data is used when not set. | Record&lt;string, any&gt;[] | — | undefined |
| virtualProps | Virtual window configuration: rowHeight/itemSize, height, buffer. | object | — | {} |
| emptyText | Empty status text. | string | — | Follow language pack |
| viewIdentity | View or user configuration ID. | string | — | undefined |
| detectResize | Compatibility properties are retained; container layout is automatically observed by ResizeObserver. | boolean | — | false |
| drawerProps | Transparent column settings drawer properties. | object | — | {} |

## Attribute Easy configuration {#easy-config}

| parameters | Description | Type | Optional value | Default value |
| --- | --- | --- | --- | --- |
| initSearchApi | true | — | — | — |
| pageChangeSearchApi | true | — | — | — |
| searchFormAttrs.labelWidth | 80 | — | — | — |
| searchFormAttrs.columns | 4 | — | — | — |
| searchFormAttrs.btnModel | inline | — | — | — |
| searchFormAttrs.columnEdit | true | — | — | — |
| tableAttrs.row-key | id | — | — | — |

## Methods {#methods}

| method name | Description | parameters |
| --- | --- | --- |
| clearSelection | Used for multi-select forms to clear user selections | — |
| toggleRowSelection | Used for multi-select tables to switch the selected state of a certain row. If the second parameter is used, it is to set whether this row is selected or not (selected is true to select) | row, selected |
| toggleAllSelection | Used for multi-select tables to switch the selected state of all rows | — |
| toggleRowExpansion | Used for expandable tables and tree tables to switch the expanded state of a row. If the second parameter is used, it is set to expand or not the row (expanded is true to expand) | row, expanded |
| setCurrentRow | Used for single-select tables to set a certain behavior to select a row. If called without parameters, the selected state of the currently highlighted row will be cancelled. | row |
| clearSort | Used to clear the sorting conditions and the data will be restored to its unsorted state. | — |
| clearFilter | When no parameters are passed in, it is used to clear all filtering conditions, and the data will be restored to an unfiltered state. You can also pass in an array composed of columnKey to clear the filtering conditions of the specified column. | columnKey |
| doLayout | Relayout the Table. This method may need to be called when the Table or its ancestor elements are switched from hidden to displayed | — |
| sort | Manually sort the Table. The parameter prop attribute specifies the sorting column, and order specifies the sorting order. | prop: string, order: string |
| resetNfSearchFormModel | Perform reset manually | — |
| onNfSearchFormValidate | Manually execute validate | callback: Function |
| onNfSearchFormSearch | Perform a search manually | — |
| onNfSearchFormExport | Execute export manually | — |
| getSelectionRows() | Get the currently selected row. | — |

## Event {#events}

| event name | Description | callback parameters |
| --- | --- | --- |
| tableEvents | Table events are consistent with el-table component Table Events | — |
| pageEvents | Pagination events are consistent with el-pagination component Events | — |
| searchFormEvents | Form events are consistent with nf-search-form component Events | — |
| NfTableActionBtnAttributes.events | actionBtnbar button event | — |
| columns[i].operationList[i].onClick | Operation function cell button click event | — |
| changeTab | Switch multiple drawer tabs | name |
| cancel | Close drawer tab | Event |
| searchApi | Same as searchFormEvents.onSearch, with slight changes in parameters | { data: nfSearchForm.getFormData(), callback: Used to close the listloading } |
| fixedColumnDragEnd | Fixed right operation column (custom handle) dragging ends | { width: number, oldWidth: number, prop?: string, column?: any, nativeEvent?: Event } |
| fieldsChange | The table shows field changes. | columns: string[] |
| update:showColumn | for v-model:showColumn. | columns: string[] |
| update:actionBarOptList | The value of the action bar control changes. | items: NfTableActionBtnAttributes[] |
| options-error | Asynchronous column option loading failed. | (error, prop: string) |

## Slot {#slots}

| Name | Description |
| --- | --- |
| append | Insert content after the last row of the table. If you need to infinitely scroll the content of the table, you may need to use this slot. If the table has a total row, this slot will be above the total row. |
| empty | Customization when table data is empty |
| searchBox | Customized search function above the table |
| actionBar | ActionBar function customization in the lower left corner of the table |
| columnEdit | Customized list editing function |
| pagination | Customization of paging function |
| btnBox | nf-search-form slot, compatible with ai-search-form extended operation button |
| columns[i].headerSlot | Customization of header functions for each tableItem |
| columns[i].slot | Each tableItem content function is customized |
| columns[i].singleHeadMutiColSlot | Customization of nested header functions for each tableItem |
| searchFormColumnEditDialogTitle | nf-search-form list editing function dialog/drawer title |
| searchFormColumnEditDialogFooter | nf-search-form list editing function dialog/drawer footer |
| tableColumnEditDialogTitle | nf-table list editing function dialog/drawer title |
| tableColumnEditDialogFooter | nf-table list editing function dialog/drawer footer |
| operation | Manipulate columns; receives row, column, index, $index. |
| operationIconColumnCheck | Customize the field setting entry embedded in the operation list header. |
| NfSearchFormItemOption.slot | Transparently transmit search form field slot; receive formData, value, update. |

## Expose {#expose}

| Name | Type | Description |
| --- | --- | --- |
| localShowItems | string[] | Column props displayed by column editing |
| tableColumns | NfTableColumnAttributes[] | Render table items |
| syncLocalShowColumnToCookies | Function | Column editing sync component to IndexedDB |
| syncCookiesToLocalShowColumn | Function | Column editor synchronizes IndexedDB to component localShowItems |
| syncCookiesToTableColumn | Function | syncCookiesToLocalShowColumn |
| syncShowItemToInitHidden | Function | showItems synchronizes props.formOptions[i].initHidden |
| resetNfSearchFormModel | Function | reset |
| onNfSearchFormValidate | Function | Verify |
| onNfSearchFormSearch | Function | Search |
| onNfSearchFormExport | Function | Export |
| nfColumCheckDialogVisible | Boolean | Column editing controls dialog/drawer display/hide |
| clearFilter | Function | table clearFilter |
| sort | Function | tablesort |
| doLayout | Function | TabledoLayout |
| clearSort | Function | tableclearSort |
| setCurrentRow | Function | tablesetCurrentRow |
| toggleRowExpansion | Function | TabletoggleRowExpansion |
| toggleAllSelection | Function | TabletoggleAllSelection |
| toggleRowSelection | Function | tabletoggleRowSelection |
| clearSelection | Function | tableclearSelection |
| nfTableRef | Ref | Table nf-table ref(div) |
| elTableRef | Ref | table el-table ref |
| nfTableActionContainerRef | Ref | Table actionBar ref(div) |
| nfTableActionBarRef | Ref | Table actionBar ref(slot) |
| nfTablePaginationRef | Ref | table pagination ref |
| nfSearchFormRef | Ref | formnf-search-form ref |
| loadingInstance | Instance | loadingInstance |
| isLoading | boolean | Table loading status |
| columnCheckNfDrawer | Ref | Column editor nf-drawer ref |
| columnCheckDialog | Ref | Column editor column-check-dialog ref |
| columnCheckDrawer | Ref | Column editor column-check-drawer ref |
| showData | Record | Paginated data (handling front-end paging and back-end paging) |

## Instructions for use {#configuration-notes}

searchApi({data, callback}) receives the converted form data and paging parameters. Callback should be called in finally whether it is successful or failed. Omit pageAttrs.total and use front-end paging. When total is passed in, the business party returns the current page data; asynchronous requests should prevent old responses from overwriting new queries.

The virtual table uses a fixed row height window and stable row-key, and no longer relies on the Vue 2 virtual table plug-in. Use normal mode for tree expansion, merged rows, and variable row height. Column settings and the old cookie naming method actually use IndexedDB. All examples are previewed within the document, and the floating layer will not be clipped by the iframe.
