PDA

View Full Version : Mask Viewport center panel on ajax eval



nadeemshafi9
26 Jun 2009, 4:58 AM
hi guys

my system works by allwoing the user to select from teh treepanel and then it loads the page via ajax wich returns extjs code which is then evaled, the response code tells itself to insert itself into the content panel in my viewport. I do this so i dont have to load things that are already loaded just cardlayout show them.

so i do

ajax request

eval result




treePanel.on('click', function(n){
var sn = this.selModel.selNode || {};
if(n.leaf && n.id != sn.id){
if(n.attributes.logout == "true"){
window.location = n.attributes.link;
}
else if(Ext.getCmp(n.attributes.content_id)){
Ext.getCmp('contentpanel').layout.setActiveItem(Ext.getCmp(n.attributes.content_id));
}
else{

Ext.Ajax.request({
url: n.attributes.link,
success: function(result, request){
eval(result.responseText);
// inserts itself into component: contentpanel
}
});
}
}
});

contentpanel = {
xtype: 'panel',
id: 'contentpanel',
region: 'center', // this is what makes this panel into a region within the containing layout
layout: 'card',
margins: '2 5 5 0',
activeItem: 0,
border: false,
autoScroll:true,
items: [
start
]
};

new Ext.Viewport({
layout: 'border',
title: 'Ext Layout Browser',
autoScroll:true,
items: [{
xtype: 'box',
region: 'north',
applyTo: 'header',
height: 35
},{
layout: 'border',
id: 'layout-browser',
region:'west',
border: false,
split:true,
margins: '2 0 5 5',
width: 275,
minSize: 100,
maxSize: 500,
items: [treePanel, detailsPanel]
},
contentpanel
],
renderTo: Ext.getBody()
});



i would like to mask the middle content pain 'content' when i do teh ajhax request and eval

i cant find any box standard methods, i have an idea of how it may be done but i would like to hear from you guys in pseudo

thanks for any help

heidtmare
26 Jun 2009, 6:11 AM
http://www.extjs.com/deploy/dev/docs/?class=Ext.LoadMask

hendricd
26 Jun 2009, 6:11 AM
Start with something like:



Ext.getCmp('contentpanel').getEl().mask('Loading...');

Then, when your 'stuff' loads (success and failure), renders


Ext.getCmp('contentpanel').getEl().unmask();See the Ext.Element.mask method for more details.

nadeemshafi9
26 Jun 2009, 6:19 AM
thanbks v much guys for putting me on teh rigth track infact hendricd thats exactly what i was looking for, i already had done this before but couldent find the snipet lol, thanks