2
我正在开发一个模块供员工参加。我正在使用手风琴,将显示年份的名称作为他们的头衔。在每一个手风琴的细节中,我都放了一个包含月份名称的网格。我可以在控制器中获得网格值,但无法获得手风琴标题的名称,这就是为什么我无法在网格中显示所需结果的原因。任何人都可以帮助我获得手风琴标题的标题吗?我的手风琴细节如下:如何从手风琴获得每个标题的名称
Ext.define('Ext4Example.view.attendence.Timeperiod' ,{
extend: 'Ext.form.Panel',
alias : 'widget.timeperiod',
id: 'timeperiod',
region: 'west',
border: false,
width: 150,
height:400,
split: true,
defaults: {
// applied to each contained panel
//bodyStyle: 'padding:15px'
},
layout: {
// layout-specific configs go here
type: 'accordion',
titleCollapse: true,
animate: true,
activeOnTop: true
},
initComponent: function() {
var today = new Date();
var yyyy = today.getFullYear();
this.items = [{
title: 'Year '+yyyy,
items: [{
xtype: 'months'
}]
//html: 'Panel content!'
},{
title: 'Year '+(yyyy-1),
items: [{
xtype: 'months'
}]
//html: 'Panel content!'
},{
title: 'Year '+(yyyy-2),
items: [{
xtype: 'months'
}]
//html: 'Panel content!'
},{
title: 'Year '+(yyyy-3),
items: [{
xtype: 'months'
}]
//html: 'Panel content!'
},{
title: 'Year '+(yyyy-4),
items: [{
xtype: 'months'
}]
//html: 'Panel content!'
}];
this.callParent(arguments);
}
});
我个网格如下:
Ext.define('Ext4Example.view.attendence.Months' ,{
extend: 'Ext.grid.Panel',
alias : 'widget.months',
border: false,
viewConfig: {
stripeRows: true
},
store: 'Months',
hideHeaders: true,
initComponent: function() {
this.store = 'Months';
this.width = 150;
this.columns = [
{
dataIndex: 'months',
flex:1
}
];
this.callParent(arguments);
}
});
我的DataGrid是如下:其中,所有加在一起是
Ext.define('Ext4Example.view.attendence.Datagrid' ,{
extend: 'Ext.grid.Panel',
alias : 'widget.datagrid',
layout: 'fit',
viewConfig: {
stripeRows: true
},
hideHeaders: false,
initComponent: function() {
this.store = 'Attendences';
//this.width = 400;
this.columns = [
{
text: 'Date',
dataIndex: 'id'
},
{
text: 'In-Time',
dataIndex: 'intime'
},
{
text: 'Out-Time',
dataIndex: 'outtime'
}
];
this.callParent(arguments);
}
});
我的主窗口给出如下:
Ext.define('Ext4Example.view.attendence.Attendencewindow' ,{
extend: 'Ext.window.Window',
alias: 'widget.attendencewindow',
title: 'Attendence Information',
layout: 'fit',
modal: true,
autoShow: true,
resizable: false,
//maximizable: true,
collapsible: true,
initComponent: function() {
this.items = [
{
xtype: 'form',
width: 550,
bodyPadding: '8 0 8 0',
border:false,
layout: {
type: 'hbox',
align: 'stretch'
},
items:[{
xtype: 'timeperiod'
},{
xtype: 'datagrid'
}]
}
];
this.buttons = [
{
xtype: 'button',
text: 'New',
iconCls: 'new',
action : 'clear'
},{
xtype: 'button',
text: 'Save',
iconCls: 'save',
//iconAlign: 'top',
action : 'save'
},{
xtype: 'button',
text: 'Print',
iconCls: 'print',
action: 'close'
//scope: this
}
];
this.callParent(arguments);
}
});
我的控制器如下:
Ext.define('Ext4Example.controller.Attendences', {
extend: 'Ext.app.Controller',
stores: [
'Attendences','Months'
],
models: [
'Attendence','Month'
],
views: [
'attendence.Timeperiod','attendence.Details','attendence.Attendencewindow','attendence.Editattendence','attendence.Months','attendence.Datagrid'
],
refs: [{
ref: 'stockaddForm',
selector: 'form'
}],
init: function() {
this.control({
'datagrid': {
itemdblclick: this.editUser
},
'months': {
itemclick: this.show
},
'attendencewindow button[action=save]': {
click: this.save
}
});
},
editUser: function(grid, record){
var view = Ext.widget('editattendence');
view.down('form').loadRecord(record);
},
show: function(grid, record) {
var hi = grid.ownerCt.title;
alert(hi);
var a = Ext.getCmp('timeperiod');
var store = this.getAttendencesStore();
store.load({
filters: [
{property:'month', value:record.data.value},
{property:'year', value:2012}
]
});
},
save: function(){
var today = new Date();
var dd = today.getDate();
var mm = today.getMonth()+1; //January is 0!
var yyyy = today.getFullYear(); //+1
Ext.Msg.alert("Today is - ",dd+" - "+mm+" - "+yyyy);
}
});
现在ü可以告诉我,我请怎样才能手风琴像2012年或2011年的冠军,我可以得到几个月的名字由record.data.value但我不能采取手风琴
称号请帮助
喜SRA,非常感谢您的回复。我编辑了我的帖子以获取完整视图。我想在年份获得手风琴冠军:2012年现在是静态的。请帮助你在这个 –
@SumonBappi编辑完成。我添加了一个私有属性,现在可以在使用up()(在控制器中完成)向上导航时引用它。这应该显示你的标题。 – sra
非常感谢你的兄弟。它正在工作。非常感谢 –