PDA

View Full Version : Refreshing an Ext.window on its button click



50120C1288
2 May 2011, 5:33 AM
Dear Friends,

Again seeking ur help as i am new this ExtJs.

I have a window .


var
window = new Ext.Window({
title: "STEP 1 : E-Form Template Creation",
width:650,
autoHeight: true,
html: htmlData,
y: 150,
listeners: {
beforeclose: function () {
searchVisible = false;
}
},
buttons: [
{
text: 'Add', handler: function() {
saveControl();
}
},
{
text:'Next', handler: function() {
window.close();
showCustomDialog();
}
}
]
});

window.show(this);


when i click on the add button i am calling the following method


function saveControl(){

eformName= $("#eformName").val();
alert(eformName);
controlType= $("#controlType").val();
labelName= $("#labelName").val();
dataType= $("#dataType").val();
required= $("#required").val();

var itemList = [];
$("#selectedItemLists option").each(function(){
itemList.push($(this).val());
alert(itemList);
});

alert(eformName);

data = "eform_name=" + eformName + "&control=" + controlType + "&labelName=" +labelName+ "&dataType=" +dataType+"&required="+required+"&items="+itemList;

alert(data);

$.ajax( {
type : "POST",
url : "/ajax/eformDetails/save.do",
data : data,
cache : false,
dataType : "text/html",
timeout: 20000,
beforeSend : function() {
showWaitingDialog("Please wait...");
},
error: function (xhr, err)
{
resolveAjaxError(xhr, err);
},
success : function(data) {

//this.window.doLayout();

}
});

}


the data coming from the controller is same and now i want to refresh the window.
on success method.

Please help me in this as it is very urgent.
seeking your help.

Thanks in advance.

Regards,
Sathya

friend
2 May 2011, 6:02 AM
Visit the Ext.Window API documentation (http://dev.sencha.com/deploy/ext-3.3.1/docs/?class=Ext.Window) and look at the load() method.

50120C1288
2 May 2011, 6:43 AM
Hi friend,

Thanks you for this .

I am still not aware of how to use this.

could you please give me an example?

Regards,
sathya

50120C1288
2 May 2011, 8:09 AM
Help me

friend
2 May 2011, 8:36 AM
If you haven't already, open the documentation link, click the triangle to the left of the load() method to open the comments section and you'll see an actual code sample.

The function specified via callback will allow you to get at the response and do anything specific to your needs:



callback: function(el, success, response, options) {
// do something whacky here.
}