Thursday, July 28, 2011

after using dojo.mixin(), need to do some post op to get rid of all 'undefined' values that passed into constructor

 after using dojo.mixin(this, p_args); have to make sure that neither of the defined as member variable is 'undefined' and note that 'undefined' can be pass into the constructor (which is different from where the parameter is not given at all) will override that '' default value.

other wise will get something like

"error: Error: *.widget.SummaryRow
template: library"

so need to do some post op to get rid of all 'undefined' values.
------------------------------------------------------------

dojo.provide("*.widget.SummaryRow");

dojo.require("dijit._Widget");
dojo.require("dijit._Templated");

dojo.declare("*.widget.SummaryRow", [ dijit._Widget,
        dijit._Templated ], {

    // Path to the template
    templateString : dojo.cache("*.widget",
            "templates/SummaryRow.html"),

    widgetsInTemplate : false,
   
    checkboxtitle : null,
    image : '',
    title : '',
    author : '',
    workflowstatus : '',
    description : '',
    contextpath : '',
    library : '',
    links : '',

    constructor : function(p_args) {
        dojo.mixin(this, p_args);
    },


    postMixInProperties : function() {
          alert("in postMixInProperties");
        this.library = this.getLibraryUuid(this.links);                     
    },

    getLibraryUuid : function(p_links) {
        alert("in getLibraryUuid(): p_links: " + p_links);
        return "WebContent";
    },

    postCreate : function() {
       
      this.inherited(arguments);
    }
});

No comments:

Post a Comment