PDA

View Full Version : form problem



wwwjsx
2 Nov 2009, 10:33 PM
When I cleaned the cache and I am trying to open window sometime the form is not loaded?

It works when I change the size manually? What is the problem?

Here is the pease of code:




// tab panel
var tabPanel = new Ext.TabPanel({
id : 'editproduct_tabpanel',
activeTab : 0,
defaults : { autoScroll: true },
border : false,
items : [
{
id : 'tabItem_product',
title : 'Product',
layout : 'form',
border : false,
isActivate : false,
listeners : {
activate: function(tTab){
// load remote component
if(typeof ProductPanel=='function'){
ProductPanel(params);
}else{
loadLocalJs('product.js', function (){
ProductPanel(params);
});
}
}
}
}
});

win = desktop.createWindow({
id : 'Win_ContentProductEdit',
title : 'Test',
width : 700,
height : 450,
bufferResize : true,
border : false,
minimizable : false,
maximizable : false,
layout : 'fit',
items : tabPanel
});

// product.js is begins here

var properties = new Ext.ux.TwinComboBox({
xtype:'combo',
fieldLabel:'Properties',
store: new Ext.data.Store({
url: 'load.php',
baseParams: {
action: 'load-default-model'
},
reader: new Ext.data.JsonReader({
root: 'records',
totalProperty: 'totalcount',
fields: ['id', 'model']
})
}),
minChars: 1,
displayField:'model',
valueField:'id',
triggerAction : 'all',
mode:'remote',
selectOnFocus: true,
typeAhead: true,
width: 165,
listWidth: 250,
pageSize: PageElCount
});

ProductPanel = function(params)
{
var getTab = Ext.getCmp('tabItem_product'); // tab item id

var form = new Ext.form.FormPanel({
id : 'edit_product_panel',
border : false,
frame : true,
autoHeight : true,
width : 'auto',
labelWidth : 130,
labelAlign : 'right',
items: [
{
xtype : 'textfield',
name : 'product_name',
fieldLabel : 'Product name',
value : options['product_name'],
width : 510
},
properties
]
});

getTab.add(form);

// if here I use the
// getTab.doLayout(); // twin combo is not shown
// If I don't use doLayout the form is not loaded
}