Skip to content

Bug: Table does not reflect changed options #261

Open
@christianitis

Description

@christianitis

Environment Details

  • react-tabulator version: 0.18.1
  • OS: Windows 10 Pro
  • Node.js version: 16.14.2

Long Description
The table does not update when an option is changed. For example, changing the options object or a column title does nothing, even though the table is re-rendering.

The following code does nothing, even though I expect the table to update its data or change a column title when the value of an <input> is changed. I know the function itself is rerunning because the console shows "This should be a rerender. whenever an input value is changed, which is expected.

import React, {useState} from "react";
import {ReactTabulator} from "react-tabulator";

export default function App() {
    const [someOptions, setSomeOptions] = useState({
        // Maybe some other options
        ajaxURL: ""
    });
    const [columnTitle, setColumnTitle] = useState("Initial title");

    console.log("This should be a rerender.")
    return(
        <div>
            <input type={"text"} onChange={event => { setSomeOptions({...someOptions, ajaxURL: event.target.value}) }}/>
            <input type={"text"} onChange={event => { setColumnTitle(event.target.value) }}/>

            <ReactTabulator
                checkOptions={true}

                options={someOptions}
                columns={[
                    {
                      title: "Some column title",
                      field: "ignoreme"
                    },
                    {
                        title: columnTitle,
                        field: "summary"
                    }
                ]}>
            </ReactTabulator>
        </div>
    )
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions