State Tracking Manager Implementation

Premium support for our pure JavaScript UI components


User avatar
rahulranjan
Premium Member
Premium Member
Posts: 497
Joined: Mon Apr 29, 2019 8:43 pm

State Tracking Manager Implementation

Post 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.
Attachments
advanced2.rar
(1.83 MiB) Downloaded 11 times

User avatar
saki
Core Developer
Core Developer
Posts: 890
Joined: Thu Mar 30, 2017 9:32 am

Re: State Tracking Manager Implementation

Post 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.

User avatar
rahulranjan
Premium Member
Premium Member
Posts: 497
Joined: Mon Apr 29, 2019 8:43 pm

Re: State Tracking Manager Implementation

Post 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.

Code: Select all

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

Code: Select all

this.gantt.taskStore.changes
If something fails i should revert/undo the changes. As in above attach project i can i achieve . Need help.

User avatar
sergey.maltsev
Core Developer
Core Developer
Posts: 683
Joined: Mon Dec 24, 2018 9:15 am

Re: State Tracking Manager Implementation

Post 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

Code: Select all

const getDefaultConfig = gantt => {
  return {
    owner: gantt,
    ...
    

User avatar
rahulranjan
Premium Member
Premium Member
Posts: 497
Joined: Mon Apr 29, 2019 8:43 pm

Re: State Tracking Manager Implementation

Post by rahulranjan »

Hi Thanks for you replay
Let me explain you you are enabling stm after project load right ?
Like below code

Code: Select all

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.

User avatar
rahulranjan
Premium Member
Premium Member
Posts: 497
Joined: Mon Apr 29, 2019 8:43 pm

Re: State Tracking Manager Implementation

Post by rahulranjan »

Any Updates on this

User avatar
saki
Core Developer
Core Developer
Posts: 890
Joined: Thu Mar 30, 2017 9:32 am

Re: State Tracking Manager Implementation

Post 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.

User avatar
rahulranjan
Premium Member
Premium Member
Posts: 497
Joined: Mon Apr 29, 2019 8:43 pm

Re: State Tracking Manager Implementation

Post 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
Attachments
advanced02.rar
(1.83 MiB) Downloaded 16 times

User avatar
Maxim Gorkovsky
Core Developer
Core Developer
Posts: 3307
Joined: Wed Jan 08, 2014 11:46 am

Re: State Tracking Manager Implementation

Post 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:

Code: Select all

// @ts-ignore
project.propagate().then(() => {
  project.taskStore.commit();
  project.dependencyStore.commit();
});
this.gantt = new Gantt({
  ...ganttConfig,
  project: project
});

User avatar
rahulranjan
Premium Member
Premium Member
Posts: 497
Joined: Mon Apr 29, 2019 8:43 pm

Re: State Tracking Manager Implementation

Post 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
Attachments
advanced02.rar
(1.84 MiB) Downloaded 16 times

Post Reply