Premium support for our pure JavaScript UI components


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 106 times

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.

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

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
const getDefaultConfig = gantt => {
  return {
    owner: gantt,
    ...
    

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

Post by rahulranjan »

Any Updates on this

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.

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 98 times

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

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.83 MiB) Downloaded 102 times

Post Reply