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 (56.46 KiB) Viewed 169 times
-
- gantt.JPG (130.82 KiB) Viewed 169 times
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'
},
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.
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 } ] });
I'm afraid not.
Tired of debugging javascript errors in web applications? Try our powerful error logging service RootCause