Page 1 of 2

State Tracking Manager Implementation

Posted: Mon Dec 02, 2019 1:54 pm
by rahulranjan
I have not used crud manager.
So when i this.gantt.taskStore.changes . In modified it gives all the present record.
It is Angular Project
Run the project
Click on Save button two new column will get added .
Do editing of columns cell
Click on change button
You will see the task in console .


I think because of state tracking manager is not implement i am not able to achieve. Please let know without transport and curd manager how can we implement STM in this use case.

Re: State Tracking Manager Implementation

Posted: Mon Dec 02, 2019 5:21 pm
by saki
Actually, there is no relation between STM (State Tracking Manager) and CrudManager. STM tracks changes in the registered stores and provides undo/redo logic. This works until you click Save because on successful save the all changes are cleared.

Please use our angular/advanced example that implements STM as a starting point.

Also, information in this post may help. It is from Ext STM but the approach is same.

Re: State Tracking Manager Implementation

Posted: Mon Dec 02, 2019 8:00 pm
by rahulranjan
Hi Saki
Thanks for info
I have gone through examples as in example it shows to enable stm after project load which i am using.
project.load().then(() => {
    // console.timeEnd("load data");
    const stm = gantt.project.stm;

    stm.enable();
    stm.autoRecord = true;

What i am looking once all the data gets loaded then tracking should happen in taskStore. And i should get changed records only
this.gantt.taskStore.changes
If something fails i should revert/undo the changes. As in above attach project i can i achieve . Need help.

Re: State Tracking Manager Implementation

Posted: Tue Dec 03, 2019 11:43 am
by sergey.maltsev
Hi, rahulranjan!

Sorry it is not quite clear what is the test case you are trying to describe in first post.

STM usage with Gantt can be checked in several demos.
Please check them before asking further questions related to STM.
Almost all shows how to revert or reapply changes.

https://www.bryntum.com/examples/gantt/advanced
https://www.bryntum.com/examples/gantt/undoredo

Also this is demo which uses server backend and STM (should be compiled locally)
examples/php/

STM docs are here
https://www.bryntum.com/docs/grid/#Common/data/stm/StateTrackingManager


P.S. To fix Gantt toolbar height just add this owner: gantt, to it's config.
examples/angular/advanced2/src/app/gantt/ganttToolbar.ts
const getDefaultConfig = gantt => {
  return {
    owner: gantt,
    ...
    

Re: State Tracking Manager Implementation

Posted: Tue Dec 03, 2019 5:24 pm
by rahulranjan
Hi Thanks for you replay
Let me explain you you are enabling stm after project load right ?
Like below code
project.load().then(() => {
const stm = gantt.project.stm;

    stm.enable();
    stm.autoRecord = true;
I my case you see i am loading the data and setting up in respective stores. You see in attachment . So what i want to ask in this case where to enable stm recording.

Re: State Tracking Manager Implementation

Posted: Fri Dec 06, 2019 11:56 am
by rahulranjan
Any Updates on this

Re: State Tracking Manager Implementation

Posted: Fri Dec 06, 2019 4:23 pm
by saki
The STM must be enabled only after all project data is loaded. Otherwise it would start to monitor empty store and and the load itself would be recorded as the changes that can be undone.

Re: State Tracking Manager Implementation

Posted: Fri Dec 06, 2019 9:38 pm
by rahulranjan
Hi Saki
I am first loading store data and then putting it in respective store under Project.
Select the task
Click on Edit task
Change the name

Click on Save
In console it always gives all the as modified even if you don't modify
In this case where to enable stm tracking and how to get added, modified and remove data.
This i want to do for all store

Re: State Tracking Manager Implementation

Posted: Mon Dec 09, 2019 11:37 am
by Maxim Gorkovsky
Hello.
When you load data from remote URL project would normally commit that data. But when you load data inline, you need to call it yourself:
// @ts-ignore
project.propagate().then(() => {
  project.taskStore.commit();
  project.dependencyStore.commit();
});
this.gantt = new Gantt({
  ...ganttConfig,
  project: project
});

Re: State Tracking Manager Implementation

Posted: Tue Dec 10, 2019 12:25 pm
by rahulranjan
Thanks a lot i work lot
One problem still i am facing
Steps
Go the task select the task , edit the task
Select the predecessor tab . add predecessor and click save
Dependency will only give modified and removed task , As i am adding it is giving empty array for it