PDA

View Full Version : Problems inverting components



tomtom-
23 Nov 2009, 6:58 AM
Good morning all,

I'm trying to do a very easier thing, but I missed.....
I'm just trying to invert component.

I have this configuration :


<div id="ext-gen47" class="x-panel-body x-table-layout-ct">
<table id="tab">
<tbody>
<tr>
<td id="ext-gen49" class="x-table-layout-cell">
<div id="table1" class=" x-table-layout-ct">
<table class="x-table-layout" cellspacing="0">
<tbody>
<tr>
<td id="ext-gen50" class="x-table-layout-cell"></td>
<td id="ext-gen51" class="x-table-layout-cell">
<div id="table2" class=" x-table-layout-ct">
div content
</div>
</td>
</tr>
</tbody>
</table>
</div>
</td>
</tr>
</tbody>
</table>
</div>
I just want to invert table1 and table2.
I tried like this :



/*Change table2 owner container*/
Ext.ComponentMgr.get('table1').ownerCt.add(Ext.ComponentMgr.get('table2'));
/*Replace table1 with table2*/
this.el.replace(dropEl);
/*Add table1 to table2*/
Ext.ComponentMgr.get(this.el.id).add(Ext.ComponentMgr.get(targetElId));
Ext.ComponentMgr.get(this.el.id).doLayout();
Table2 is ok, but I lost table1.

If anyone has an idea......

Thanks,

Tom

js_coder
23 Nov 2009, 8:51 AM
Where does dropEl come from?

tomtom-
23 Nov 2009, 9:02 AM
Hi js_coder,

Sorry for this mistake.

The second code part is :



var dropEl = Ext.get('table1');
var srcEl = Ext.get('table2');
/*Change table2 owner container*/
Ext.ComponentMgr.get('table1').ownerCt.add(Ext.ComponentMgr.get('table2'));
/*Replace table1 with table2*/
srcEl.replace(dropEl);
/*Add table1 to table2*/
Ext.ComponentMgr.get('table2').add(Ext.ComponentMgr.get('table1'));
Ext.ComponentMgr.get('table2').doLayout();

tomtom-
24 Nov 2009, 2:28 AM
up !

tomtom-
24 Nov 2009, 3:05 AM
To simplify the problem, I have done that :



var table1 = Ext.ComponentMgr.get('table1');
var table2 = Ext.ComponentMgr.get('table2');

/*Adding table1 to the parent of table2*/
table1.ownerCt.add(table2);


All containers have a TableLayout.
So, I can see that table2 is an item on table0 that is the container of table1.
But the screen shows me that table2 is steel a child of table1 ! I see the same thing looking at sources with firebug !!!!

Has anyone an suggestion ?

Thanks,

Tom