Skip to content

Q: Is it possible to customize the built in columns like the createTextColumn function? #77

Answered by nick-keller
GeorgeCodeHub asked this question in Q&A
Discussion options

You must be logged in to vote

The intColumn is a few lines of codes only and actually uses createTextColumn (see code).
You can simply copy-paste this in your code and change it as you see fit:

export const createIntColumn = ({ min, max }: { min: number, max: number}) => createTextColumn<number | null>({
  alignRight: true,
  formatBlurredInput: (value) =>
    typeof value === 'number' ? new Intl.NumberFormat().format(value) : '',
  parseUserInput: (value) => {
    const number = parseFloat(value)
    return !isNaN(number) ? Math.max(min, Math.min(max, Math.round(number))) : null
  },
  parsePastedValue: (value) => {
    const number = parseFloat(value)
    return !isNaN(number) ? Math.max(min, Math.min(max, Math.round(

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by nick-keller
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #76 on November 03, 2021 18:05.