RevoGrid Adapter
Use @zeus-web/revogrid-adapter to map Zeus Data Grid rows, columns, sorting and selection state to a <revo-grid> custom element without bundling RevoGrid itself.
@zeus-web/revogrid-adapterAdvancedGenerated
Playground
Source
Choose the framework entry that matches your application.
html
<script type="module">
import '@zeus-web/revogrid-adapter/wc/auto'
const adapter = document.querySelector('#grid-adapter')
const output = document.querySelector('#adapter-state')
adapter.rows = [{ id: 'row-1', owner: 'Ada' }]
adapter.columns = [
{ id: 'owner', field: 'owner', header: 'Owner', width: 180 },
]
adapter
.componentOnReady()
.then(() => adapter.refresh())
.then(() => adapter.getState())
.then(state => {
output.textContent = JSON.stringify(state, null, 2)
})
</script>
<zw-revogrid-adapter id="grid-adapter"></zw-revogrid-adapter>
<pre id="adapter-state"></pre>tsx
import { RevoGridAdapter } from '@zeus-web/revogrid-adapter/react'
export function GridBridge() {
return (
<RevoGridAdapter
rows={[{ id: 'row-1', owner: 'Ada' }]}
columns={[{ id: 'owner', field: 'owner', header: 'Owner' }]}
/>
)
}vue
<script setup lang="ts">
import { RevoGridAdapter } from '@zeus-web/revogrid-adapter/vue'
const rows = [{ id: 'row-1', owner: 'Ada' }]
const columns = [{ id: 'owner', field: 'owner', header: 'Owner' }]
</script>
<template>
<RevoGridAdapter :rows="rows" :columns="columns" />
</template>When to use
- Use it when the application has registered a real
<revo-grid>implementation and needs to connect a Data Grid model. - Bridge an existing Data Grid data source to a RevoGrid-compatible table component.
- Reuse one adapter behavior protocol across native Web Component, React and Vue.
When not to use
- Do not treat it as a model request library.
- Do not embed provider request logic inside the component.
- Do not put credentials, secrets or tokens in component props.
- Do not import the real @revolist/revogrid implementation in adapter templates.
- Do not replace the built-in data-grid with RevoGrid for simple cases.
Install
bash
pnpm add @zeus-web/revogrid-adapterComponent family
zw-revogrid-adapter
Slots
zw-revogrid-adapter
- No public members documented.
Events
zw-revogrid-adapter
adapter-readyadapter-change
Methods
zw-revogrid-adapter
getRevoColumnsgetRevoSourcegetRevoSortgetRevoSelectiongetStategetGridElementsetRowssetColumnssetSelectionsetSortclearSortrefresh
Examples
React package usage
Use the generated RevoGrid adapter wrapper from the advanced package in React applications.
tsx
import { RevoGridAdapter } from '@zeus-web/revogrid-adapter/react'
const columns = [
{ id: 'name', header: 'Name', field: 'userName', sortable: true },
{ id: 'role', header: 'Role', field: 'role', sortable: true },
]
const rows = [
{ id: 'u1', userName: 'Ada Lovelace', role: 'Engineer' },
{ id: 'u2', userName: 'Grace Hopper', role: 'Compiler' },
]
export function Example() {
return (
<RevoGridAdapter
ariaLabel="Users"
columns={columns}
rows={rows}
selectionMode="multiple"
sortColumn="role"
sortDirection="asc"
/>
)
}Native Web Component usage
Use the auto entry when the host application is not React or Vue.
ts
import '@zeus-web/revogrid-adapter/wc/auto'
const adapter = document.createElement('zw-revogrid-adapter')
adapter.setAttribute('aria-label', 'Users')
adapter.setAttribute('selection-mode', 'multiple')
adapter.setAttribute('sort-column', 'role')
adapter.setAttribute('sort-direction', 'asc')
adapter.columns = columns
adapter.rows = rows
document.body.append(adapter)AI usage hints
- Use revogrid-adapter when generating a table that bridges to RevoGrid, and leave
<revo-grid>registration to the application. - Use the Data Grid model for columns, rows, sorting and selection to keep adapter behavior consistent.
- Continue to use data-grid for lightweight cases.
- Keep business request logic in the application layer.
- Do not import the real @revolist/revogrid implementation in revogrid-adapter templates.