Page 1 of 1

[REACT] Reloading data does not restore task position

Posted: Thu Sep 29, 2022 12:41 pm
by jit@flowit.dk
src.zip
Example demonstrating the problem
(9.58 KiB) Downloaded 23 times

Hi,

Please see attached example (tested with version 5.1.2).

Try changing e.g. the name/title of a task and click "Reload data". Changes are reverted.
Try changing the position of a task (move it above/below a sibling) and click "Reload data". The task's position is NOT restored.

Is this a bug or are we doing something wrong ?

-- Thanks


Re: [REACT] Reloading data does not restore task position

Posted: Thu Sep 29, 2022 7:37 pm
by marcio

Hey Jimmy,

That looks like a bug, thanks for the report and the example. I create a ticket to fix it https://github.com/bryntum/support/issues/5336


Re: [REACT] Reloading data does not restore task position

Posted: Fri Sep 30, 2022 3:54 pm
by marcio

Hey Jimmy,

An update about that issue, is not a bug, for performance reasons, the React Gantt has the syncDataOnLoad config set to true by default, which will update the dataset and not replace it, if you set up that config to false, it'll work (I tested it here :) )

const ganttConfig: BryntumGanttProps = {
        "autoHeight": true,
        "width": "100%",
        "startDate": "2020-01-27",
        "endDate": "2025-12-30",
        "weekStartDay": 1,
        // "calendars": [],
        // "assignments": [],
        // "dependencies": [],
        // "resources": [],
        // "columns": [],
        "zoomKeepsOriginalTimespan": true,
        "zoomOnMouseWheel": true,
        "minZoomLevel": 5,
        "maxZoomLevel": 11,
        "zoomLevel": 7,
        project: {
            eventStore: {
                syncDataOnLoad : false,
            }
        }
    };

Re: [REACT] Reloading data does not restore task position

Posted: Mon Oct 03, 2022 8:59 am
by jit@flowit.dk

Hi Marcio.

Thank you. How do we set it when using inline data?
We are not allowed to define 'project' alongside inline data (see attached screenshot).


Re: [REACT] Reloading data does not restore task position

Posted: Mon Oct 03, 2022 3:41 pm
by marcio

Hey Jimmy,

To work with inline data we recommend using the BryntumProjectModel component to be able to set up some project configurations.

I created a basic demo with the code that you shared earlier, and you can also check our inline data demo to see how that's set up https://www.bryntum.com/examples/gantt/frameworks/react/javascript/inline-data/build/