Our state of the art Gantt chart


Post by wacii »

Hello,

Can you specify a react editor for columns?

I have it working initially, but it throws an error when I unmount the gantt component with an open editor. Since this feature isn't documented (at least in the gantt docs, although it is included in examples), I was wondering if it wasn't officially supported yet.

The error happens during the destroy method of the Base class. When trying to remove some property from the widget wrapping the react component. gantt.module.js:2873 Uncaught TypeError: Cannot delete property 'value' of [object Object]

Not much is needed to reproduce. The frameworks/react/basic example can be used as long as you introduce a way to unmount the gantt component. Here is what I used:

class MyEditor extends React.Component {
  getValue() {
    return '';
  }

  setValue() {}

  isValid() {
    return true;
  }

  focus() {}

  render() {
    return 'editor';
  }
}

const columns = [
  {
    field: 'name',
    editor: ref => <MyEditor ref={ref} />
  }
];

const data = [{ id: 1, name: 'Task 1' }];

const MyGanttWrapper = () => {
  const [show, setShow] = useState(true);
  const toggleShow = () => setShow(currentShow => !currentShow);

  return (
    <>
      <button onClick={toggleShow} type="button">
        Toggle
      </button>
      {show && <BryntumGantt columns={columns} data={data} />}
    </>
  );
}

Open up an editor then click the toggle button to unmount the gantt component.


Post by wacii »

I'm working in v5.0.6, but I tested in v5.1.0 as well.


Post by saki »

This is a bug so I've created ticket for the issue: https://github.com/bryntum/support/issues/5041


Post Reply