PDA

View Full Version : Problem with doLayout()



DJ JJ
24 Jan 2011, 7:36 AM
I've got a tabpanel with only a tab. In this tab there are some div that I generate automatically on notifydrop. After the generation of the new div, I need to refresh the panel to show it, so I use the method doLayout(), but nothing happening, the panel isn't not refreshed. If I refresh the page manually, the div is showed... is there anything wrong?



this.dropTarget=this.body;
var dd = new Ext.dd.DropTarget(this.dropTarget, {
ddGroup:'treeDD'
,notifyDrop:function(dd, e, node) {
var q=50;
var w=50;
var z=Ext.getCmp('datFed').div;
var p=Ext.getCmp('datFed');

//z is the array where I have all my div
z.push({x:q, y:w, i:'ABR'});

p.fireEvent('itemdrag', this);
p.doLayout();

return true;
}
});


the tab panel is put inside a viewport with a tree panel
http://img831.imageshack.us/img831/249/immaginegpe.th.png (http://img831.imageshack.us/i/immaginegpe.png/)

25 Jan 2011, 10:48 AM
doLayout does nothing for adding a div and has everything to do w/ managing components. I don't see how you're adding a new instance of any component to the container.


All that said, you need a lesson on developing readable code. one letter references are the enemy of future refactoring and debugging.

DJ JJ
26 Jan 2011, 12:50 AM
Hi Jesus Garcia, thank you for the reply. I resolved my problem :) I know that the code was incomplete, it was only a piece, because I noticed that if I post the full code here on the forum people is scared about it and don't reply to me. I posted the full code in another post and I didn't receive any reply, so I tried this way. About the code, I know how to write it and I know that I must use significant names when I declare variables.
Then, I read your book man, and it's awesome! It helped me to understand better the framework... you would write other books! Thank you again