Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Order + filter with formatted data

Aperta
#5,045 4 commenti 4 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
react, typescript
Ambito
frontend

Direzione di ricerca

Inizia con il CodeSandbox collegato e confronta le definizioni delle colonne usando cell, accessorFn, getValue e il comportamento di ordinamento e filtraggio in react-table 8.9.3. Traccia come vengono esposti i valori originali e formattati per ogni operazione, quindi verifica che il caso riprodotto possa ordinare in base alla data o al numero originali mentre filtra in base al relativo valore di visualizzazione formattato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Describe the bug

i need to transform the data to show to the user.

Eg from YYYY-MM-DD to DD/MM/YYYY,
from usd 10.99 to usd 10,99.

Anyway, to order i need to use de original data ( a date or decimal number), to filter i need to use the transformed data or both.
dont exist a property in the row with columnId to return the transformed data (row.original, row.getValue and row.renderValue just return the original data).

i tried to pass the transformed data thru accessorFn: row => formatDate(row.field), but with this approach, i lose the original data in order function, and ordering with transformatted data gives me a wrong ordenation.

how to solve this problem?

Your minimal, reproducible example

https://codesandbox.io/s/nice-ishizaka-s2n6mw?file=/src/App.tsx

Steps to reproduce

create a row
{
header: "name",
accessorKey: "nameKey",
cell: ({getValue}) => formatDate(getValue())
},
// this option i lose the formatted data to filter
or
{
header: "name",
id: 'nameKey',
accessorFn: row => formatDate(row.date),
},
// this option i lose the original data to order

const formatDate = (date: string | Date, format?: string) => {

// console.log("date", date)
format = format || 'dd/MM/yyyy';

return dateFormat(toDate(date), format);

};

Expected behavior

order by original data and filter by transformed data

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

all Operating System and Browsers

react-table version

8.9.3

TypeScript version

5.2.2

Additional context

No response

Terms & Code of Conduct
  • I agree to follow this project's Code of Conduct
  • I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.
Lingua principale
TypeScript
Stelle
28.5k
Fork
3.6k
Merge medio
19h 40m
PR unite (30g)
8

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di TanStack/table

Tutte le issue di TanStack/table

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.