Opened 12 years ago

Closed 12 years ago

#4076 closed defect (fixed)

use constructor to initialize hash or array variables, postscript to do widget lifecycle stuff

Reported by: bill Owned by: bill
Priority: high Milestone: 1.0
Component: Dijit Version: 0.9
Keywords: Cc:
Blocked By: Blocking:

Description (last modified by bill)

  1. in Widget.js, call create() from postscript() rather than constructor():
        postscript: function(params, srcNodeRef){
            // this happens only after all construction is done
            this.create(params, srcNodeRef);
        },
    
  1. certain widgets have code in preamble(). move that to constructor() instead.
  1. ValidationTextBox? and Combobox have code like
    if(this.query==dijit.form.ComboBoxMixin.prototype.query){this.query={};}
    

to make sure that each widget gets it's own copy of query (but that we don't overwrite a parameter specified to the widget constructor (and mixed in to the widget). Should be changed to simpler

constructor: function(){
  this.query={};
}

Change History (4)

comment:1 Changed 12 years ago by bill

See [10190] for example.

comment:2 Changed 12 years ago by bill

Description: modified (diff)
Summary: use preamble to initialize hash or array variablesuse constructor to initialize hash or array variables, postscript to do widget lifecycle stuff

Scott says we should stop using preamble because it will break if it's called from a mixin (meaning, it will execute too late for our purposes). Changing bug description for new approach.

comment:3 Changed 12 years ago by bill

Owner: set to bill
Status: newassigned

comment:4 Changed 12 years ago by bill

Resolution: fixed
Status: assignedclosed

(In [10412]) 1. in Widget.js, call create() from postscript() rather than constructor()

  1. for widgets using preamble(), move code in preamble() to constructor() instead.
  2. change ValidationTextBox? and Combobox to use constructor to initialize arrays/hashes, rather than if() statement referencing prototype

Fixes #4076.

Note: See TracTickets for help on using tickets.