Ticket #6696 (closed defect: fixed)

Opened 2 months ago

Last modified 7 weeks ago

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
Severity: major Keywords: declare
Cc: anthony.fryer@…

Description (last modified by BryanForbes) (diff)

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

test_grid_programmatic.html (3.6 kB) - added by guest 2 months ago.

Change History

Changed 2 months ago by guest

  Changed 2 months ago by dante

  • owner changed from sorvell to bryanforbes
  • priority changed from normal to high

follow-up: ↓ 3   Changed 2 months ago by dante

  • milestone set to 1.2

in reply to: ↑ 2   Changed 2 months 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

  Changed 2 months ago by BryanForbes

  • owner changed from bryanforbes to BryanForbes
  • description modified (diff)

  Changed 2 months ago by pottedmeat

This is a bug in declare.

  Changed 2 months ago by BryanForbes

  • keywords declare added; grid destroy _Events removed
  • owner changed from BryanForbes to sjmiles
  • component changed from DojoX Grid to Core
  • description modified (diff)

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.

  Changed 2 months ago by BryanForbes

  • 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 */
});

  Changed 2 months ago by BryanForbes

  • description modified (diff)
  • summary changed from VirtualGrid.destroy doesn't work because of inheritance of _Events to dojo.declare doesn't allow mixins that aren't declared with dojo.declare

Updated the summary and made the description a bit shorter.

  Changed 2 months ago by guest

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

Eduardo

  Changed 7 weeks ago by sjmiles

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

  Changed 7 weeks ago by sjmiles

  • status changed from new to closed
  • resolution set to fixed

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.