gregnb / gregnb/mui-datatables

customHeadRender not working

Open
#1,550 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
2.7k
Forks
906
PR merge metrics
No merged PRs in 30d

Description

Hi, I am trying to use `customHeadRender` in order to use my own icon. I keep getting this bug despite following the documentation on how write the `customHeadRender`.

Here is how my `customHeadRender` is written as:

` customHeadRender: (columnMeta, handleToggleColumn, sortOrder) => {
return (


Last Modified


)
}`

Whenever I click on the `TableSortLabel`, I expect the `handleToggleColumn` function to run and sort the list. But instead, I get this bug:

![image](https://user-images.githubusercontent.com/23179977/96172549-9df7bd80-0ef4-11eb-9870-cf64c008f022.png)

`TypeError: a[d] is undefined`

Is there a way to fix this. Are there any examples on how to do `customHeadRender`?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the reported customHeadRender case using the shown TableCell, TableSortLabel, and handleToggleColumn entry points. Confirm that clicking the label sorts the list without the reported TypeError; document or test the working customHeadRender usage once the behavior is corrected.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.