Skip to content

Vben Vxe Table

Vben Vxe Table wraps vxe-table together with Vben Form so you can build searchable data grids with a shared API.

Adapter Example

The current renderer adapter uses renderTableDefault(...) for table cell rendering:

ts
vxeUI.renderer.add('CellImage', {
  renderTableDefault(_renderOpts, params) {
    const { column, row } = params;
    return h(Image, { src: row[column.field] });
  },
});

vxeUI.renderer.add('CellLink', {
  renderTableDefault(renderOpts) {
    const { props } = renderOpts;
    return h(
      Button,
      { size: 'small', type: 'link' },
      { default: () => props?.text },
    );
  },
});

Basic Usage

vue
<script setup lang="ts">
import { useVbenVxeGrid } from '#/adapter/vxe-table';

const [Grid, gridApi] = useVbenVxeGrid({
  gridOptions: {},
  formOptions: {},
  gridEvents: {},
});
</script>

<template>
  <Grid />
</template>

GridApi

MethodDescriptionType
setLoadingupdate loading state(loading: boolean) => void
setGridOptionsmerge new grid options(options: Partial<VxeGridProps['gridOptions']>) => void
reloadreload data and reset pagination(params?: Record<string, any>) => void
queryquery data while keeping the current page(params?: Record<string, any>) => void
gridvxe-grid instanceVxeGridInstance
formApisearch form APIFormApi
toggleSearchFormtoggle or force the search form visible state(show?: boolean) => boolean

Props

PropDescriptionType
tableTitletable titlestring
tableTitleHelphelp text for the table titlestring
classclass for the outer containerstring
gridClassclass for the vxe-grid nodestring
gridOptionsvxe-grid optionsDeepPartial<VxeTableGridOptions>
gridEventsvxe-grid event handlersDeepPartial<VxeGridListeners>
formOptionssearch form optionsVbenFormProps
showSearchFormwhether the search form is visibleboolean
separatorseparator between the search form and table bodyboolean | SeparatorOptions

Slots

SlotDescription
toolbar-actionsleft side of the toolbar, near the title
toolbar-toolsright side of the toolbar, before built-in tool buttons
table-titlecustom table title

All named slots starting with form- are forwarded to the search form.

Contributors

The avatar of contributor named as xingyu4j xingyu4j

Changelog

Released under the MIT License.