jbetancur / react-data-table-component

A responsive table library with built-in sorting, pagination, selection, expandable rows, and customizable styling.
https://react-data-table-component.netlify.app
Apache License 2.0
2.04k stars 411 forks source link

Warning: title is a string based column selector which has been deprecated as of v7 and will be removed in v8[DESCRIPTION] #1016

Closed FatimeyiZahra closed 1 year ago

FatimeyiZahra commented 2 years ago

I GOT THOOSE 2 ERROR FROM TableCol.tsx:123. HOPE UR TEAM LL FIX IT

Warning: title is a string based column selector which has been deprecated as of v7 and will be removed in v8. Instead, use a selector function e.g. row => row[field]...

TableCol.tsx:123 Warning: director is a string based column selector which has been deprecated as of v7 and will be removed in v8. Instead, use a selector function e.g. row => row[field]...

AND I DONT WANNA IMPORT BOOTSTRAP.MIN.CSS CUZ IM USING ANT ANT DESIGN AND METERIAL UI. BOOTSTRAP.MIN.CSS CHANGED MY DESIGN. IS THERE ANY WAY FOR EXAMPLE IF I WANNA USE DATATABLE I SHOULD IMPORT ONLY CSS FILE FOR DATATABLE

jbetancur commented 2 years ago

selectors need to be functions not strings in V7. that's it and it is in the docs

selector: 'whatever' should now be selector: row => row.whatever

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

mcamendoza1 commented 2 years ago

@FatimeyiZahra

this might work for you. From:

const columns = [
    {
        name: 'Title',
        selector: 'title',
    },
    {
        name: 'Year',
        selector: 'year',
    },
];

To this:

const columns = [
    {
        name: 'Title',
        selector: row => row.title,
    },
    {
        name: 'Year',
        selector: row => row.year,
    },
];

@jbetancur this is not should an issue :) might consider closing it.