PalmyraGrid#

@palmyralabs/rt-forms-mantine · grid/PalmyraGrid.tsx

Overview#

Server-backed grid. Internally composes GridX (the base Mantine table + toolbar + pagination) and subscribes to a pub-sub topic so other parts of the app can refresh or refilter the grid without holding its ref.

Signature#

const PalmyraGrid = forwardRef(function PalmyraGrid<ControlPropsType>(
  props: PalmyraGridOptions<ControlPropsType>,
  ref: RefObject<IPalmyraGrid>,
): JSX.Element);

Props — PalmyraGridOptions<ControlPropsType> (from @palmyralabs/rt-forms)#

Common props include:

Prop Type Purpose
columns ColumnDefinition[] Column defs
endPoint IEndPoint Wire endpoint path
storeOptions StoreOptions? Forwarded to the store factory
pageSize number | number[]? Options for the page-size selector
topic string? Base topic name for the external bus
DataGridControls ComponentType<ControlPropsType>? Toolbar / row-action component
controlProps ControlPropsType? Props forwarded to the controls component
initParams { filter?, sort?, limit?, offset? }? Initial query state

Full prop contract lives in the upstream @palmyralabs/rt-forms package.

Topic bus#

When topic = 'manufacturer' (for example):

Channel Direction Payload
manufacturer/refresh in (none) — calls refresh()
manufacturer/filter in filter object — replaces current filter
manufacturer/data out emitted after each data-change

Publish from anywhere using @palmyralabs/ts-utilstopic:

import { topic } from '@palmyralabs/ts-utils';
topic.publish('manufacturer/refresh', {});
topic.publish('manufacturer/filter', { status: 'ACTIVE' });

Ref — IPalmyraGrid#

Exposes the full IPageQueryable surface plus grid-specific helpers.

Example#

import { PalmyraGrid } from '@palmyralabs/rt-forms-mantine';
import { manufacturerColumns } from './columns';

export function ManufacturerGrid() {
  return (
    <PalmyraGrid
      topic="manufacturer"
      columns={manufacturerColumns}
      endPoint="/mstManufacturer"
      pageSize={[15, 30, 45]}
      initParams={{ sort: ['-id'], limit: 15, offset: 0 }}
    />
  );
}