PDA

View Full Version : With a Controller ,collapse event is fired twice?



RobinOuyang
2 Apr 2013, 10:45 PM
If I configure the controllers in RSSPubApp, then the collapse event of nav (left pannel) dose not work right. It seems that the event is fired twice. But if the remove the controller configuration, It works right.
What is the problem?


Ext.define("rsspub.RSSPubApp",{
extend:"Ext.app.Application",
namespaces:['rsspub'],
name: 'rsspub',
appFolder: 'app',
controllers:["pub.FeedListCtrl"],
launch: function() {
var logo={
region: 'north',
html: '<div id="app_logo">RSS PUB</div>'+
'<div id="user_exit"><span>Hello</span> | <span>Exit</span></div>',
border: false,
bodyStyle:"background-color:#157FCC;color:#FFFFFF;",
margins: '0 0 5 0'
};
var nav = Ext.create("rsspub.view.pub.FeedList",{itemId:"feedList"});
var main=Ext.create("rsspub.view.pub.FeedContent",{itemId:'mainPanel'});
Ext.create('Ext.container.Viewport', {
layout: 'border',
items: [logo,nav,main]
});
}
});
Ext.application("rsspub.RSSPubApp");



Ext.define('rsspub.controller.pub.FeedListCtrl', {
extend: 'Ext.app.Controller',
views:["pub.FeedList"],
init: function() {
this.control({
'#feedList': {
select: this.onFeedSelect
}
});
},


onFeedSelect: function(rm,r,i,eo){
var fileName = r.get("fileName");
var mainPanel = Ext.ComponentQuery.query("#mainPanel")[0];
if(false == Ext.isEmpty(fileName)){
mainPanel.refreshContent(fileName);
}
else{
mainPanel.initContent();
}
}
});

RobinOuyang
3 Apr 2013, 12:10 AM
SOLVED. The top viewport's layout must be fit, cannot be border.