Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When DijitRegistry extension enabled, editors are not destroyed on grid.destroy() #804

Closed
Housik opened this issue Jan 5, 2014 · 3 comments

Comments

@Housik
Copy link

Housik commented Jan 5, 2014

When declaring dGrid with DijitRegistry, editors are not destroyed on dgrid.destroy(). Behaviour will change, when DijitRegistry extension is removed... in editor.js there is some testing for editOn parameter (line #497), which is in this case null... so column.editorInstance.destroyRecursive() is not fired.

Wiki says (https://github.com/SitePen/dgrid/wiki/Working-with-Widgets), that dGrid.removeRow() is fired, when grid is destroyed... this also doesn't seems to be true. Try it.

Test for dgrid.destroy() derived from /dgrid/test/dijit_layout_programmatic.html
https://gist.github.com/anonymous/8273129

In this test, Grid is destroyed, when tab is closed. You can uncomment destroy() method of editor to see, it will not be called on grid.destroy(). Using latest master version of dgrid.

@treasonx
Copy link
Contributor

It looks like there are two mistakes in your gist.

I have fixed the errors in this fork of your gist.
https://gist.github.com/treasonx/8418685

First Error:
In the onClose handler for the tab you remove the gridTab before calling destroy. When you do this the dom elements for the grid are removed. So calling destroy later causes the child dijits to not trigger their destroy function.

Second Error:
In your destroy handler for your TextBox editors you log a message saying that destroy was called. But you never call this.inherited so the dijits are not removed from the registry.

@Housik
Copy link
Author

Housik commented Jan 14, 2014

Thank you very much James for your reply and assistance! 👍 I will test it. About the second error, there was a problem, that a destroy method was not called at all (so I didn't care about including this.inherited), but as you said, it is (probably) related to the first error.

@Housik
Copy link
Author

Housik commented Jan 25, 2014

James, I was following official documentation for Dijit Layout - it says, you have first remove child (tab), then call destroy() - see http://dojotoolkit.org/reference-guide/1.9/dijit/layout.html (part "Remove Child"). I can confirm, you are right in case of dgrid -> simply calling destroy() is working OK.

May be it is good to consider highlighting this modified logic in documentation of dGrid and compare it with example from official dijit layout doc (link above).

@Housik Housik closed this as completed Jan 25, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants