Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

155
Views
Type error when using render when defining table columns in material table React

HI I am using Material table to generate table view, here I defined the columns:

const columns: TableColumn[] = [
    {
        title: 'TYPE',
        field: 'type_of_action',
        highlight: true,
    },
    {
        title: 'DESCRIPTION',
        field: 'description',
    },
    {
        title: 'REFERENCE ID',
        field: 'reference_id'
    },
    {
        title: 'ENVIRONMENT',
        field: 'environment'
    },
    {
        title: 'SEVERITY',
        field: 'severity'
    },
    {
        title: 'PRIORITY',
        field: 'priority'
    },
    {
        title: 'ACTION',
        field: 'action',
        render: (rowData) => (
            console.log(rowData.priority). <---- error
        ),
    }
];

I used render in the last columns. but I saw a error in my Intellij like:

TS2339: Property 'priority' does not exist on type '{}'.

actually my code works and I can see rowData.priority printed out in my console.

I now rowData here is type{} and cannot recognize priority

In order to resolve this, I need to define it inside the <MaterialTable> tag, otherwise fields cannot be recognized?

But putting so many lines of codes in the tag looks very dirty.Any ways to extract the column to a const variable while avoiding the type error?

One idea in my mind is to pass the columns variable in first, and manipulate using map, but I am not sure how to do this?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Try adding the type property to your columns definition when the type is different than string:

const columns: TableColumn[] = [
{
        title: 'PRIORITY',
        field: 'priority',
        type: 'number'
    }
]

Posible values are: 'boolean', 'numeric', 'date', 'datetime', 'time', 'currency'.

You can find more details in this PR.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!