Hi,
I need a way to completely reset a Gantt. A little background: I'm currently implemented a gantt and render it to a div inside an existing angular project. When the relevant partial view is loaded with the div, a function is being invoke by the controller to run Ext.Microloader (Extjs, manifest and required files is already loaded in the index.html).
So far so good, everything is working fine until this point. Now I need a way to completely remove the gantt, load the data again from the server and render a new gantt to the same div based on the newly arrived data. Lets say the user goes to another view, play around a little bit here and there, and then return to the gantt - I don't want to refresh the page, but I need to get the data again in case something has changed.
I've tried all the destroy method that I could find, but nothing help... every time I try the reload the gantt I get a bunch of error because I have duplicates values, its like I can't get rid of the old data .
Can someone help ?
Support Forum
Hello.
Can you provide us more info about erorrs? Call stack, error message? When does the error occur: on first render, after destroy, or when creating new gantt after destroy? Can you provide us runnable test case?
We have tests, destroying gantt, to check if there is a leak and they are green, so destroying should work fine.
Can you provide us more info about erorrs? Call stack, error message? When does the error occur: on first render, after destroy, or when creating new gantt after destroy? Can you provide us runnable test case?
We have tests, destroying gantt, to check if there is a leak and they are green, so destroying should work fine.
OK. I've manged to remove the old data. It was an object on the crudStore i didn't wipe. Now i can recreate the gantt a few times and after a while i get this error:
Uncaught TypeError: Cannot read property 'getBoundingClientRect' of null
in app.js
Maybe you can give me some guidelines what do i need to invoke to perform a clean wipe? And how to create is again from scratch?
Uncaught TypeError: Cannot read property 'getBoundingClientRect' of null
in app.js
Maybe you can give me some guidelines what do i need to invoke to perform a clean wipe? And how to create is again from scratch?
Destroy order should be gantt, crud, stores. If you destroy everything you created - listeners should also be destroyed. Take a look into manager listeners which destroy themselves.
This is a very big project... so its hard to know what to copy here. But anyway, i have "loadData" function, when the function end all the stores and crudManager is setup and available. now i have another function "loadView", it doing some stuff, and at the end:
When the page load everything is fine If i invoke "destroy" (by calling myApp.app.mainView.destroy()) on this view, the next time i invoke "loadView" i get an error:
Uncaught TypeError: Cannot read property 'rendered' of null in
bryntum-gantt-pro/src/Gnt/plugin/ConstraintResolutionGui.js : 40
I need a way to completely remove and then recreate this view.
me.mainView = me.getMainViewportView().create({
viewModel: {
type: 'advanced-viewport',
data: {
crud: me.crudManager,
undoManager : me.undoManager,
taskStore: me.crudManager.getTaskStore(),
calendarManager: me.crudManager.customCalendarManager,
currentLocale: me.currentLocale,
availableLocales: me.getLocalesStore(),
availableSimulations: availableSimulations,
hasChanges: true,
readOnlyMode: false,
}
},
columns: columns,
needAdjustToCalendar : needAdjustToCalendar,
crudManager: me.crudManager,
startDate: this.startDate,
endDate: this.endDate,
title: title,
renderTo: 'gantt-container'
});
Uncaught TypeError: Cannot read property 'rendered' of null in
bryntum-gantt-pro/src/Gnt/plugin/ConstraintResolutionGui.js : 40
I need a way to completely remove and then recreate this view.