Opened 12 years ago

Closed 11 years ago

#6696 closed defect (fixed)

dojo.declare doesn't allow mixins that aren't declared with dojo.declare

Reported by: guest Owned by: sjmiles
Priority: high Milestone: 1.2
Component: Core Version: 1.1.0
Keywords: declare Cc: anthony.fryer@…
Blocked By: Blocking:

Description (last modified by Bryan Forbes)

The destroy method doesn't work on the Grid at the moment. It produces an error message saying something about not finding the m.findMixin method.

The reason for this error is because of the inheritance of VirtualGrid? from _Events, or more precisely it is because of the way _Events is defined. _Events does not use dojo.declare. Instead it is created as an empty function which is then dojo.extend'ed with methods.

To fix the Grid destroy method, _Event just needs to be defined using dojo.declare. Below is how _Event should be declared to resolve this bug.

dojo.provide("dojox.grid._Events");

dojo.declare("dojox.grid._Events", null, {
    /* _Events methods go here */
});

Attachments (1)

test_grid_programmatic.html (3.6 KB) - added by guest 12 years ago.

Download all attachments as: .zip

Change History (12)

Changed 12 years ago by guest

Attachment: test_grid_programmatic.html added

comment:1 Changed 12 years ago by dante

Owner: changed from sorvell to bryanforbes
Priority: normalhigh

comment:2 Changed 12 years ago by dante

Milestone: 1.2

comment:3 in reply to:  2 Changed 12 years ago by guest

Replying to dante:

Hi Dante,

Is it possible to rise a bit the priority of this bug ?. It is pretty critical, the problem (as you can see in the attached file I placed) the destroy simple crash, so any command after it will not be executed, "destroy" is a pretty important method in grid. This problem was introduced in the nightly build of the 7/5/2008, in the 6/5/2008 it was ok

Thanks very much

Eduardo

comment:4 Changed 12 years ago by Bryan Forbes

Description: modified (diff)
Owner: changed from bryanforbes to Bryan Forbes

comment:5 Changed 12 years ago by Neil Roberts

This is a bug in declare.

comment:6 Changed 12 years ago by Bryan Forbes

Component: DojoX GridCore
Description: modified (diff)
Keywords: declare added; grid destroy _Events removed
Owner: changed from Bryan Forbes to sjmiles

After looking at this, I've found that this is the problem:

dojox.grid._Events = function(){}; dojo.extend(dojox.grid._Events, { /* some functions and stuff */ }); dojo.declare("dojox.grid.VirtualGrid?", [ dijit._Widget, dijit._Templated, dojox.grid._Events ], {

/* more stuff here */

});

This should be valid. I want to show in the declaration of VirtualGrid? (and thus, in the API documentation) that it mixes _Events onto itself. Since _Events is being used as a mixin, it shouldn't have to have anything special about it. There should be a check in declare to make sure that "findMixin" is actually on the object you're working with.

comment:7 Changed 12 years ago by Bryan Forbes

Description: modified (diff)

Sorry, I forgot to use wiki formatting for the code example:

dojox.grid._Events = function(){};
dojo.extend(dojox.grid._Events, { /* some functions and stuff */ });
dojo.declare("dojox.grid.VirtualGrid", [ dijit._Widget, dijit._Templated, dojox.grid._Events ], {
	/* more stuff here */
});

comment:8 Changed 12 years ago by Bryan Forbes

Description: modified (diff)
Summary: VirtualGrid.destroy doesn't work because of inheritance of _Eventsdojo.declare doesn't allow mixins that aren't declared with dojo.declare

Updated the summary and made the description a bit shorter.

comment:9 Changed 12 years ago by guest

Was this bug corrected?. The destroy method seems to work again in the last nightly build.

Eduardo

comment:10 Changed 11 years ago by sjmiles

(In [13829]) Do not assume baseclass implements _findMixin. Refs #6696. !strict

comment:11 Changed 11 years ago by sjmiles

Resolution: fixed
Status: newclosed

dojox.grid._Events is now defined via declare, which I believe has fixed the "grid destroy" problem, but in any case I've added a test for existence of "_findMixin" to declare.

Note: See TracTickets for help on using tickets.