Support for v6.x of our Scheduling components


Post by fmijas »

Hello guys
I have the following scenario.
I am using Ext Gantt 6.x in an ASP.NET application

I implemented the sequence column in a customized way, as shown below


// getting sequence value
 Ext.define('plugin.model.Task', {
            extend: 'Gnt.model.Task',
            // adding few custom fields to the model
            fields: [
                { name: 'PurchaseId' },
                { name: 'Sequence', critical: true, serialize: function (v, task) { return task.getSequenceNumber(); } }
            ]
        });       
        
//THEN // TO FORCE POST ALL FIELDS var crudManager = Ext.create('Gnt.data.CrudManager', { taskStore: taskStore, autoLoad: true, extend: 'Gnt.data.CrudManager', //// TO FORCE POST ALL FIELDS writeAllFields: true, alias: 'crudmanager.advanced-crudmanager', transport: { load: { method: 'Get', paramName: 'q', url: origin + '/GanttCrud/load?id=' + id, }, sync: { method: 'POST', url: origin + '/GanttCrud/sync' } } }); //THEN // TO DIFINE SEQUENCE COLUMN columns: [ { xtype: 'sequencecolumn', cls: 'sequencecolumn', dataIndex: 'Sequence' }, ...

In my data model I also added the sequence column where I use it to store the sequence number in database

I identified that when I click the save button gannt the component sends in json only the line that I added and update parent tasks, with its respective information as picture gantt.JPG. attached and json below

{
   "type":"sync",
   "requestId":721363345942,
   "revision":0,
   "tasks":{
      "added":[
         {
            "leaf":true,
            "index":2,
            "parentId":243,
            "StartDate":"2021-05-31T00:00:00+01:00",
            "EndDate":"2021-07-10T00:00:00+01:00",
            "Cls":"",
            "Name":"New task",
            "Duration":30,
            "Effort":null,
            "EffortUnit":"h",
            "ActualEffort":null,
            "EffortVariance":null,
            "CalendarId":"",
            "Note":"",
            "DurationUnit":"d",
            "PercentDone":0,
            "Cost":0,
            "ActualCost":0,
            "CostVariance":0,
            "ConstraintType":"",
            "ConstraintDate":null,
            "ManuallyScheduled":false,
            "SchedulingMode":"Normal",
            "BaselineStartDate":null,
            "BaselineEndDate":null,
            "BaselinePercentDone":0,
            "BaselineEffort":null,
            "BaselineCost":null,
            "ReadOnly":false,
            "Rollup":false,
            "PhantomId":"plugin.model.Task-1",
            "PhantomParentId":null,
            "ShowInTimeline":false,
            "DeadlineDate":null,
            "Sequence":9
         }
      ],
      "updated":[
         {
            "CalendarId":"",
            "leaf":false,
            "Id":238,
            "Name":"TESTE PROJECT GANTT",
            "StartDate":"2021-03-01T00:00:00+00:00",
            "EndDate":"2021-08-17T00:00:00+01:00",
            "Duration":121,
            "DurationUnit":"d",
            "PercentDone":0,
            "SchedulingMode":"Normal",
            "BaselineStartDate":null,
            "BaselineEndDate":null,
            "BaselinePercentDone":0,
            "Cls":"",
            "index":0,
            "Sequence":1,
            "Effort":null,
            "EffortUnit":"",
            "Note":"",
            "ConstraintType":"",
            "ConstraintDate":null,
            "ManuallyScheduled":false,
            "Rollup":false,
            "ShowInTimeline":false,
            "PurchaseId":null,
            "Segments":null,
            "parentId":"root",
            "ActualEffort":null,
            "EffortVariance":null,
            "Cost":0,
            "ActualCost":0,
            "CostVariance":0,
            "BaselineEffort":null,
            "BaselineCost":null,
            "ReadOnly":false,
            "PhantomId":"",
            "PhantomParentId":null,
            "DeadlineDate":null
         },
         {
            "CalendarId":"",
            "leaf":false,
            "Id":243,
            "Name":"Execution",
            "StartDate":"2021-05-31T00:00:00+01:00",
            "EndDate":"2021-08-07T00:00:00+01:00",
            "Duration":50,
            "DurationUnit":"d",
            "PercentDone":0,
            "SchedulingMode":"Normal",
            "BaselineStartDate":null,
            "BaselineEndDate":null,
            "BaselinePercentDone":0,
            "Cls":"",
            "index":2,
            "Sequence":6,
            "Effort":null,
            "EffortUnit":"",
            "Note":"",
            "ConstraintType":"",
            "ConstraintDate":null,
            "ManuallyScheduled":false,
            "Rollup":false,
            "ShowInTimeline":false,
            "PurchaseId":null,
            "Segments":null,
            "parentId":238,
            "ActualEffort":null,
            "EffortVariance":null,
            "Cost":0,
            "ActualCost":0,
            "CostVariance":0,
            "BaselineEffort":null,
            "BaselineCost":null,
            "ReadOnly":false,
            "PhantomId":"",
            "PhantomParentId":null,
            "DeadlineDate":null
         },
         {
            "CalendarId":"",
            "leaf":true,
            "Id":245,
            "Name":"Implementation",
            "StartDate":"2021-06-07T00:00:00+01:00",
            "EndDate":"2021-07-17T00:00:00+01:00",
            "Duration":30,
            "DurationUnit":"d",
            "PercentDone":0,
            "SchedulingMode":"",
            "BaselineStartDate":null,
            "BaselineEndDate":null,
            "BaselinePercentDone":0,
            "Cls":"",
            "index":3,
            "Sequence":10,
            "Effort":null,
            "EffortUnit":"",
            "Note":"",
            "ConstraintType":"",
            "ConstraintDate":null,
            "ManuallyScheduled":false,
            "Rollup":false,
            "ShowInTimeline":false,
            "PurchaseId":null,
            "Segments":null,
            "parentId":243,
            "ActualEffort":null,
            "EffortVariance":null,
            "Cost":0,
            "ActualCost":0,
            "CostVariance":0,
            "BaselineEffort":null,
            "BaselineCost":null,
            "ReadOnly":false,
            "PhantomId":"",
            "PhantomParentId":null,
            "DeadlineDate":null
         },
         {
            "CalendarId":"",
            "leaf":true,
            "Id":247,
            "Name":"Go-live",
            "StartDate":"2021-08-02T00:00:00+01:00",
            "EndDate":"2021-08-07T00:00:00+01:00",
            "Duration":5,
            "DurationUnit":"d",
            "PercentDone":0,
            "SchedulingMode":"",
            "BaselineStartDate":null,
            "BaselineEndDate":null,
            "BaselinePercentDone":0,
            "Cls":"",
            "index":4,
            "Sequence":11,
            "Effort":null,
            "EffortUnit":"",
            "Note":"",
            "ConstraintType":"",
            "ConstraintDate":null,
            "ManuallyScheduled":false,
            "Rollup":false,
            "ShowInTimeline":false,
            "PurchaseId":null,
            "Segments":null,
            "parentId":243,
            "ActualEffort":null,
            "EffortVariance":null,
            "Cost":0,
            "ActualCost":0,
            "CostVariance":0,
            "BaselineEffort":null,
            "BaselineCost":null,
            "ReadOnly":false,
            "PhantomId":"",
            "PhantomParentId":null,
            "DeadlineDate":null
         }
      ]
   }
}

the problem is, when i save this information i lose sequence control, as picture sql.PNG

I would like to know if there is any way to post all the gannt lines (task) in the updade structure, even without changing the information.

Best Regards

Fabio Mijas

Attachments
sql.PNG
sql.PNG (56.46 KiB) Viewed 169 times
gantt.JPG
gantt.JPG (130.82 KiB) Viewed 169 times

Post by pmiklashevich »

Please see the reply here: viewtopic.php?p=31211#p31211

Few side notes:
Do not use serialize since it only defines what you send to the server. It doesn't set the value field.

Do not use SequenceColumn for your field, since the column has the renderer which ignores dataIndex you set. You can compare the values:

        { xtype : 'sequencecolumn' },
        {
            xtype     : 'gridcolumn',
            dataIndex : 'MySequence'
        },
Pavel Miklashevich - Core Developer

Post by fmijas »

Hello miklashevich.
Thanks for your support and these tips.
I don't know why but I can't access this topic you sent me. when I tried, I got this message: You are not authorised to read this forum.

Do you know why?

Thanks
Fabio Mijas


Post by pmiklashevich »

I'll re-post it here:

You can:
1) add to task model a new persistable field to keep sequence number value
2) update this field with getSequenceNumber result whenever affecting event happens (task indent/outdent/insert/remove/reordering). Indent/outdent/reordering are basically remove+insert. So seems you have to listen only to add/remove events on task store.

Pavel Miklashevich - Core Developer

Post by pmiklashevich »

Also you can save the index provided by NodeInterface:

You can turn node "index" field to persistent one. This will force ExtJS to mark involved tasks as dirty after sorting and pass "index" values to the server. Of course you'll have to handle it on the server side (add column to tasks table etc.):

Ext.define('MyTaskModel', {
    extend : 'Gnt.model.Task',
    fields : [
        { name: 'index', type : 'int', persist : true }
    ]
});
Pavel Miklashevich - Core Developer

Post by fmijas »

Hello
is there any way to mark all the tasks as dirty? regardless of whether or not I change them within the gant

Fabio Mijas


Post by mats »

I'm afraid not.

Tired of debugging javascript errors in web applications? Try our powerful error logging service RootCause


Post Reply