How I can getValue by type in a cell?

46 views Asked by At

I have a type for defining the columns and some fields are types.

How I can getValue by type in a cell?

For exemple, how i get the "real" value from the field "status"?

Column type:

export type DSchedule = {
    status: ScheduleStatus
    date: string
    branch: string
    requester: string
    supplier: string
    plate: string
    type: ScheduleType
    dateEstimatedStop: string
    dateRealStop: string
    dateVeichleClearance: string
    budget: BudgetStatus
  }

Status definition:

export enum ScheduleStatus {
    Aguardando,
    Agendado,
    Cancelado,
    EmServico,
    Liberado
}

Column definition:

info.getValue() receives an error const columnHelper = createColumnHelper()

const columns = [
  columnHelper.accessor('status', {
    header: () => "Status",
    cell: info => <StatusSchedulePill status={info.getValue()}/>,
    footer: info => info.column.id,
  }),

My Component:

    export default function BudgetIcon(props: { status: BudgetStatus }) {
        switch (props.status) {
            case BudgetStatus.Pendente:
                return (
                    <Center>
                        <Tooltip label="Orçamento pendente. Clique para aprovar">
                            <Link href="a">
                                <ActionIcon variant="filled" aria-label="Settings">
                                    <IconHourglass style={{ width: '70%', height: '70%' }} stroke={1.5} />
                                </ActionIcon>
                            </Link>
                        </Tooltip>
                    </Center>
                )
...
...

I read the official documentation, but I didn't find an example like this

0

There are 0 answers