开发者

YUI: String works, but a var containing a string doesnt?

开发者 https://www.devze.com 2022-12-21 10:07 出处:网络
var allRows = this.getTbodyEl().rows; for (var i = allRows.length - 1; i >= 0; i--){ var thisRowID = allRows[i].id;
var allRows = this.getTbodyEl().rows;
for (var i = allRows.length - 1; i >= 0; i--){
 var thisRowID = allRows[i].id;
 // Clean up any existing Drag instances
 if (myDTDrags[thisRowID]) {
    myDTDrags[thisRowID].unreg();
    delete myDTDrags[thisRowID];
 }
 // Create a Drag instance for each row
 myDTDrags[thisRowID] = new YAHOO.util.DDProxy(thisRowID);
};

I can't figure out why, but the above code is not yielding a DDProxy object for each row in my table. I have verified that the DDProxy code is all loaded and running properly by passing a string reference to a DOM element:

myDTDrags[thisRow开发者_C百科ID] = new YAHOO.util.DDProxy('yui-rec30');

This makes the corresponding row draggable as expected! I have also verified, using typeof, that the value of thisRowID is indeed of the type 'string' AND that the string contains the id of appropriate row elements.

What have I missed?


UPDATE: My code posted above is correct. I was wrong in that the contents of my thisRowID variable did NOT contain a reference to an appropriate row element!

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号