0
내 응용 프로그램 (MVC)에서 공유는 사용자가 내에서 필요한 열을 볼 수 있도록해야 내보기extjs4 열 숨기기 탭
Ext.define('App.view.cube.MainView', {
extend: 'Ext.panel.Panel',
....
layout: 'card',
...
dockedItems: [{
xtype: 'panel',
items: [{
// a drop down containing 2 choices
}]
}],
items: [{
xtype: 'tabpanel',
itemId: 'mmtabs',
activeTab: 1,
items: [{
title: 'Served',
xtype: 'treepanel', // my own xtype extending this xtype
id: 'Served :',
itemId: '1'
}, {
title: 'UnServed',
xtype: 'treepanel', // my own xtype extending this xtype
id: 'UnServed :',
itemId: '0'
}, {
title: 'Total',
xtype: 'treepanel', // my own xtype extending this xtype
id: 'Total :',
itemId: '2'
}]
}]
});
기본적으로
두 가지 선택에 드롭 다운을 3 개 탭 같은 설계 그리드 (treepanel). 앱이 처음로드되고 사용자가 드롭 다운의 다른 선택 항목으로 변경되면 열이 숨길 정도로 숨기지 않습니다. 하지만 다른 탭으로 이동 한 다음 똑같은 일을하면 모든 것이 정상적으로 작동합니다. 나는 그 문제를 알아낼 수 없다. 코드의
나 다른 itemIds를 구비하여 세 개의 탭 걸쳐
xtype : 'treepanel', // my own xtype extending this xtype
재사용하고 상기 (난이 미세 바란다). 내 컨트롤러에서
내가보기 (숨기기/표시 특정 열) initialview로 전환 (모든 탭에서 모든 열을 반복하고 적절한보기 설정) 내보기 내에서 콤보 상자에 호출 changeview을하는 기능을 가지고있다.
toggleView: function (cubemwwar, viewId) {
if ("2" == viewId) {
cubemwwar.columns[1].setVisible(false);
cubemwwar.columns[2].setVisible(false);
cubemwwar.columns[3].setVisible(false);
cubemwwar.columns[4].setVisible(true);
cubemwwar.columns[5].setVisible(true);
cubemwwar.columns[6].setVisible(true);
}
if ("1" == viewId) {
cubemwwar.columns[1].setVisible(true);
cubemwwar.columns[2].setVisible(true);
cubemwwar.columns[3].setVisible(true);
cubemwwar.columns[4].setVisible(false);
cubemwwar.columns[5].setVisible(false);
cubemwwar.columns[6].setVisible(false);
}
}, // on controller's onlaunch
initialView: function() {
var numTabs = this.getCubeMainView().query('#mmtabs')[0].items.length;
for (var i = 0; i < numTabs; i++) {
var tab = this.getCubeMainView().query('#mmtabs')[0].items.items[i];
this.toggleView(tab, 1);
}
},
// change views based on user selection
// from the combobox's select event
changeView: function (combo, rec, idx) {
// first time somehow the columns do not hide
// hide/show appropriate columns
// rec[0].data.id .. .possible values 1 and 2 only.
this.toggleView(this.getCubeMainView().query('#mmtabs')[0].getActiveTab(), rec[0].data.id);
},