I wonder if you can help me in here.
I want to handle errors when a task fails to update the Gantt chart. And also a notification message to display the success/failure message after saving.
I tried adding this in taskstore, but no luck.
successProperty: 'success',
listeners: {
exception: function () {
alert(success);
}
},
var taskStore = Ext.create("Gnt.data.TaskStore", {
model: 'TaskModel',
calendar : rootCalendar,
proxy: {
type: 'ajax',
headers: { "Content-Type": 'application/json' },
api: {
read: 'webservices/tasks.asmx/Get',
create: 'webservices/tasks.asmx/Create',
destroy: 'webservices/tasks.asmx/Delete',
update: 'webservices/tasks.asmx/Update'
},
writer: {
type: 'json',
root: 'jsonData',
encode: false,
allowSingle: false
},
reader: {
type: 'json',
root: function (o) {
if (o.d) {
return o.d;
}
else {
return o.children;
}
}
}
}
});
var g = Ext.create("MyApp.DemoGanttPanel", {
region: 'center',
rowHeight: 26,
selModel: new Ext.selection.TreeModel({
ignoreRightMouseSelection: false,
mode: 'MULTI'
}),
taskStore: taskStore,
dependencyStore: dependencyStore,
assignmentStore: assignmentStore,
resourceStore: resourceStore,
// generalShiftCalendar: generalShiftCalendar,
generalCalendar: rootCalendar,
//snapToIncrement : true, // Uncomment this line to get snapping behavior for resizing/dragging.
columnLines: false,
rowLines: false,
startDate: new Date(2013, 6, 11),
// endDate: Sch.util.Date.add(new Date(2013, 6, 4), Sch.util.Date.WEEK, 20),
endDate: Sch.util.Date.add(new Date(2013, 6, 11), Sch.util.Date.MONTH, 10),
viewPreset: 'weekAndDayLetter',
// GK added new properties
//renderTo: Ext.getBody(),
renderTo: 'gantt_container',
multiSelect: true,
cascadeChanges: true,
rightLabelField : 'Responsible',
// GK ends here
});
g.on({
dependencydblclick: function (ga, rec) {
var from = taskStore.getNodeById(rec.get('From')).get('Name'),
to = taskStore.getNodeById(rec.get('To')).get('Name');
Ext.Msg.alert('Hey', Ext.String.format('You clicked the link between "{0}" and "{1}"', from, to));
},
timeheaderdblclick: function (col, start, end) {
Ext.Msg.alert('Hey', 'You click header cell : ' + Ext.Date.format(start, 'd-m-Y') + ' - ' + Ext.Date.format(end, 'd-m-Y'));
}
});
return g;
}
Thanks
Gopi