How is dojo.placed supposed to be written?
I am trying to place a select box with an id but I think I am not entering the parameters correctly on the dojo.place method because it is rendering in firefox but not IE:
var removeOpt = dojo.query('#sSec2 option');
this._sec1 = new widget.StyledDropdown(dojo.byId("sSec1"), function(){
dojo.hitch(sm, sm.collectInfo);
//Make sure the second security question does not populate with the first security question option selected
var el = this._el, selected = this.getValue();
// empty out the other select menu
//dojo.empty(dojo.byId('sSec2'));
dojo.query("#sSec2 option").forEach(dojo.destroy);
// looping thru the cached options for the second select menu
dojo.forEach(removeOpt, function(that){
if (that.value != selected) {
dojo.place(that, dojo.byId('sSec2'));
}
});
// rebuild
Dropdowns.byId('sSec2').build();
}, true);
var removeOpt2 = dojo.query('#sSec1 option');
this._sec2 = new widget.StyledDropdown(dojo.byId("sSec2"), functi开发者_JS百科on(){
dojo.hitch(sm, sm.collectInfo2);
//Make sure the first security question does not populate with the second security question option selected
var el = this._el, selected = this.getValue();
// empty out the other select menu
//dojo.empty(dojo.byId('sSec1'));
dojo.query("#sSec1 option").forEach(dojo.destroy);
// looping thru the cached options for the second select menu
dojo.forEach(removeOpt2, function(that){
if (that.value != selected) {
dojo.place(that, dojo.byId('sSec1'));
}
});
// rebuild
Dropdowns.byId('sSec1').build();
can I get some suggestions?
The way you're calling it would add each as the (currently) last child of the node with id "sSec2".
http://dojotoolkit.org/api/dojo/place
More importantly though, what is your if condition checking? What is selected
? It's not quoted - is that intentional?
EDIT RE: updated code
Okay, the context brought in by the surrounding code raises a couple more potential troubleshooting points.
- is
this.getValue()
returning what you expect? (presumablytrue
orfalse
to jive with the comparisons in question)- Maybe throw a console.log or alert inside those if statements to see if the code is even reaching there, ever?
- On your
dojo.hitch
lines, are you intending to execute that function? If so, add another()
at the end -dojo.hitch
returns a function, doesn't execute it itself. - Also, this may be irrelevant but I'm a tad bit curious - I'm assuming your
widget.StyledDropDown
doesn't extenddijit._Widget
? Since the arguments you're passing your constructor are in a completely different format.
Would it be possible for you to throw a (not-)working sample on http://jsfiddle.net/ ?
精彩评论