Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

showDirty is lagging the visual feedback for percentDone #10246

Open
chuckn0rris opened this issue Oct 22, 2024 · 0 comments
Open

showDirty is lagging the visual feedback for percentDone #10246

chuckn0rris opened this issue Oct 22, 2024 · 0 comments
Labels
bug Something isn't working forum Issues from forum

Comments

@chuckn0rris
Copy link

Forum post

I've run into a weird behavior that feels like a bug... or maybe there's something that I need to do that I'm not aware of. What am I doing wrong?

If you load the Gantt Advanced demo - https://bryntum.com/products/gantt/examples/advanced/ - and then run this code in the console (run each block and observe the results in the gantt control before running the next block):

// 1) Enable show dirty, and make a change to a name
window.gantt.showDirty = { duringEdit: true };
window.gantt.tasks[2].name = "test" 
// Name is correctly shown an as modified

// 2) update percentDone
window.gantt.tasks[2].percentDone = 100;
window.gantt.tasks[2].commitAsync(); // <-- does nothing
window.gantt.project.commitAsync(); // <-- does nothing
// Percent Done is still shown as unmodified, but it is modified

// 3) Poke it by changing % Done column to the same value a gain
window.gantt.tasks[2].percentDone = 100;
// Now it is correctly shown as modified

// 4) Reset to the initial value
window.gantt.tasks[2].percentDone = 50;
// Still shown as modified, though the task is unmodified (or at least it's the original value)

// 5) Reset to the initial value, again
window.gantt.tasks[2].percentDone = 50;
// Now it is correctly shown as unmodified

I detected this while testing buttons in my website for setting percentDone to 0, 25, 50, 75, and 100... it's like the status of percentDone lags by one change... but changing Name responds immediately.

Here's the code that I'm using in my project to try to update the selected tasks to a given percent complete:

function setPercentDoneForSelectedTasks(percent) {
            const selectedTasks = gantt.selectedRecords;

        selectedTasks.forEach(task => {
            task.percentDone = percent;
            task.commitAsync();
        });

        window.gantt.project.commitAsync().then(() => {
            console.log("All tasks added and changes committed.");
        }).catch(err => {
            console.error("Error during commitAsync:", err);
        });
    }
@chuckn0rris chuckn0rris added bug Something isn't working forum Issues from forum labels Oct 22, 2024
@chuckn0rris chuckn0rris changed the title showDirty is lagging the visual feedback for percentDone showDirty is lagging the visual feedback for percentDone Oct 22, 2024
@chuckn0rris chuckn0rris changed the title showDirty is lagging the visual feedback for percentDone showDirty is lagging the visual feedback for percentDone Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working forum Issues from forum
Projects
None yet
Development

No branches or pull requests

1 participant