var loadedData;
Ext.define('Gnt.examples.advanced.crud.CrudManager', {
extend: 'Gnt.data.CrudManager',
alias: 'crudmanager.advanced-crudmanager',
autoLoad: true,
transport: {
load: {
method: 'GET',
disableCaching: false,
paramName: 'q',
url: '../../AdvancedGantt/Load/?id=@ViewBag.Id'//"@*@Url.Action("Load", "GanttCrud", new { id = ViewBag.Id })*@"
// timeout : 600000
},
sync: {
method: 'POST',
url: '../../AdvancedGantt/sync'
}
},
listeners:
{
load: function (crudManager, response, responseOptions, eOpts) {
console.log("la responsa")
console.log(response);
loadedData = response;
}
}
});
Ext.define('Gnt.examples.advanced.overrides.MSImportPanel', {
extend: 'Ext.form.Panel',
requires: [
'Ext.form.field.File',
'Ext.button.Button'
],
alias: 'widget.msimportpanel',
border: false,
defaults: {
margin: 5
},
layout: 'hbox',
submitURL: '@Url.Action("Process", "MPPFile",new { id = ViewBag.id})',
initComponent: function () {
Ext.apply(this, {
items: [
{
labelWidth: 50,
allowBlank: false,
xtype: 'filefield',
itemId: 'form-file',
emptyText: 'Select .mpp file',
fieldLabel: 'File',
name: 'mpp-file',
buttonText: '',
buttonConfig: {
iconCls: 'fa fa-folder-open'
}
},
{
xtype: 'button',
text: 'Load file',
formBind: true,
handler: function () {
var panel = this,
form = panel.getForm();
if (form.isValid()) {
form.submit({
url: this.submitURL,
reset: true,
waitMsg: 'Loading data...',
failure: function (form, action) {
var msg = (action.result && action.result.msg) || (action.response && action.response.responseText);
Ext.Msg.alert('Import failed', 'Please make sure the input data is valid. Error message: ' + msg);
form.reset();
form.isValid();
},
success: function (form, action) {
console.log('dependencies', action.result.data.dependencies);
loadedData.resources.rows.forEach(function (record) {
action.result.data.resources.push(record);
});
loadedData.assignments.rows.forEach( function (record) {
action.result.data.assignments.push(record);
});
loadedData.tasks.rows.forEach(function (record) {
action.result.data.tasks.push(record);
});
loadedData.dependencies.rows.forEach(function (record) {
action.result.data.dependencies.push(record);
});
panel.fireEvent('dataavailable', panel, action.result.data);
form.isValid();
}
});
}
},
scope: this
}
]
});
this.callParent(arguments);
}
});
Support Forum
Hi, I am having trouble with Import MPP when i upload a .MPP file when i import a MPP file it remove the previous data in the gantt and put the new data in the gantt that come from the .MPP file ,so i had tried to append it by the following code
When I Push the dependencies i got the following error
ok thanks Maxim Gorkovsky for your reply see my attached file
https://www.dropbox.com/s/jwurvlh6dl4tj ... t.mp4?dl=0
https://www.dropbox.com/s/jwurvlh6dl4tj ... t.mp4?dl=0
I'm afraid video recording is not helpful in this case. I meant an actual runnable test case, a js app that we can run locally and see.
This exception says task that you are making a source for dependency does not exist. See line 131 in Importer.js. Investigate why taskMap does not contain specific id. In order to append tasks to existing tree you should've refactored Importer#importData method:
1) it should set id 'root' to the new root, use some other id
2) instead of setRoot method should call taskStore.appendChild(newRoot)
This exception says task that you are making a source for dependency does not exist. See line 131 in Importer.js. Investigate why taskMap does not contain specific id. In order to append tasks to existing tree you should've refactored Importer#importData method:
1) it should set id 'root' to the new root, use some other id
2) instead of setRoot method should call taskStore.appendChild(newRoot)