PDA

View Full Version : problem in ux.status bar problem



Abisha
30 Jun 2009, 5:54 AM
Dear Friends!
I tried to use statusbar in my application. Here the status bar is displaying properly. But when i submit the form with invalid messages, It is not showing any error messages and the status is in "Ready". But when i submit the form with valid data, The status is updated with data saved. I am using the following code. I am struggling with this for 3 days. But i am not understanding where i am doing wrong. Can you please help me anybody to complete this?
Thanks in advance.


new_handler_rep=function(){
Ext.getCmp('repair_main').getForm().reset();
Ext.getCmp('repair_main2').getForm().reset();
Ext.getCmp('com_repair_sub_frm_udf').getForm().reset();
Ext.getCmp('shipping_form').getForm().reset();
Ext.getCmp('billing_form').getForm().reset();
Ext.getCmp('content-panel').layout.setActiveItem('tabs-nested-layouts-panel');

};

var statusbar= new Ext.StatusBar({
id: 'form-statusbar',
defaultText: 'Ready',
plugins: new Ext.ux.ValidationStatus({form:'repair_main'}),
//items:[tabsNestedLayouts],
items:[{
text:'New',
handler: new_handler_rep
},{
text:'Save',
handler:function(){
if(Ext.getCmp('repair_main').getForm().isValid() &&
Ext.getCmp('com_repair_sub_frm_udf').getForm().isValid()){
var sb = Ext.getCmp('form-statusbar');
sb.showBusy('Saving form...');
Ext.getCmp('repair_main').getForm().submit({
url: '../php/repair_center_new.php?act=insert',
method:'POST',
params: {
udf_1: Ext.get('udf_1').dom.value,
udf_2: Ext.get('udf_2').dom.value,
udf_3: Ext.get('udf_3').dom.value,
udf_4: Ext.get('udf_4').dom.value,
udf_5: Ext.get('udf_5').dom.value,
udf_6: Ext.get('udf_6').dom.value,
udf_7: Ext.get('udf_7').dom.value,
udf_8: Ext.get('udf_8').dom.value,
udf_9: Ext.get('udf_9').dom.value,
buyer_company: Ext.get('buyer_company').dom.value,
buyer: Ext.get('buyer').dom.value,
ship_to: Ext.get('ship_to').dom.value,
bill_to: Ext.get('bill_to').dom.value,
attention: Ext.get('attention').dom.value,
address1: Ext.get('address1').dom.value,
address2: Ext.get('address2').dom.value,
address3: Ext.get('address3').dom.value,
attention1: Ext.get('attention1').dom.value,
address4: Ext.get('address4').dom.value,
address5: Ext.get('address5').dom.value,
address6: Ext.get('address6').dom.value,
start_date: Ext.get('start_date').dom.value
},
enctype:'multipart/form-data',
success: function(){
sb.setStatus({
text:'Data saved!',
iconCls:'',
clear: false
});
repair_store.reload();
Ext.getCmp('repair_main').getForm().reset();
Ext.getCmp('repair_main2').getForm().reset();
Ext.getCmp('com_repair_sub_frm_udf').getForm().reset();
Ext.getCmp('shipping_form').getForm().reset();
Ext.getCmp('billing_form').getForm().reset();
}
});
}
}
},{
text:'Cancel',
handler:function(){
Ext.getCmp('content-panel').layout.setActiveItem('start-panel');
Ext.getCmp('repair_main').getForm().reset();
Ext.getCmp('repair_main2').getForm().reset();
Ext.getCmp('com_repair_sub_frm_udf').getForm().reset();
Ext.getCmp('shipping_form').getForm().reset();
Ext.getCmp('billing_form').getForm().reset();
}
},{
text:'Help',
handler:function(){
Ext.getCmp('content-panel').layout.setActiveItem('help-panel');
}
}]
});// JavaScript Document

I am positioning this status bar in my extjs popup window's tbar.


MyDesktop.ServiceRequestWindow = Ext.extend(Ext.app.Module, {
id:'sr-win',
init : function(){
this.launcher = {
text: 'Repair Center',
iconCls:'icon-repair_center',
handler : this.createWindow,
scope: this
}
},

createWindow : function(){
var desktop = this.app.getDesktop();
var win = desktop.getWindow('sr-win');
if(!win){
win = desktop.createWindow({
id: 'sr-win',
title: 'Repair Center',
iconCls: 'icon-repair_center',
shim:false,
animCollapse:false,
constrainHeader:true,
maximized : true,
layout: 'fit',
items:
new Ext.Panel({
layout: 'tdgi_border',
tbar: statusbar,
items: [search_tab,{
layout: 'form',
id: 'layout-browser',
region:'west',
border: false,
//frame: true,
autoScroll:true,
split:true,
margins: '2 0 5 5',
width: 210,
minSize: 210,
maxSize: 210,
items: [treePanel]
},
contentPanel
]
})
});
}
win.show();
}
});

I am facing one more problem. When i reopen the window, The statusbar is not showing.

Thanks in advance!!