그리드 안에 콤보 상자가 2 개 있습니다. 두 번째 콤보 상자 값은 첫 번째 콤보 상자의 기준이됩니다.
예를 들어 콤보에는 3 항목이 있습니다. 아메리카, 유럽, 아시아.
첫 번째 콤보 상자에서 유럽을 선택한 경우 두 번째 콤보 상자에서 유럽이 다시 나타나지 않습니다.
MY 콤보 STORE
이미 선택되어있을 때 콤보 상자 값을 숨기기
var cb_group = Ext.create('Ext.data.Store', {
model: 'cb_group',
autoLoad: false,
proxy: {
type: 'ajax',
url: 'srv/master/group/combo',
reader: {
type: 'json',
root: 'rows'
}
}
});
MY COMBO INSIDE GRID
: 내가 사용의 ExtJS 버전을 모르는
, 여기
하지만 코드의
var set_approval_dtl = Ext.create('Ext.Window', {
title: title_approval2, width: 850, height: 395, rowdblclick: true, forceFit: true,
closeAction: "hide", store: ms_set_approval_dtl_store,
defaults: {
sortable: true, resizable: false
},
items: [
{xtype: "form", items: [
{layout: 'column', columnWidth: .5, itemId: 'set_approve', defaults: {border: false},
items: [{xtype: "panel", itemId: "set_approve_panel", height: 330, defaultType: 'textfield', margin: '0 10px 0 10px',
defaults: {labelWidth: 120, width: 850, maxLength: 200},
items: [
{xtype: "grid", itemId: "grid_items", width: 782, height: 280, margin: '0 10px 10px 10px', autoScroll: true,
plugins: Ext.create('Ext.grid.plugin.CellEditing', {clicksToEdit: 1, pluginId: 'rowEditing'}),
store: ms_set_approval_dtl_store, stripeRows: true, defaultType: "gridcolumn",
viewConfig: {forceFit: true},
columns: [
{header: grid18j, width: 150, dataIndex: 'nm_act', align: 'center'},
{header: subtitle_approval3, width: 126, dataIndex: 'level1', align: 'center',
editor: {xtype: "combobox", name: "cdgr", itemId: "cdgr1", typeAhead: true, editable: false, triggerAction: "all", forceSelection: true,
emptyText: grid8k, store: cb_group, valueField: "id", displayField: "nm",
listeners: {
expand: function(field, options, val) {
if (Ext.typeOf(field.getPicker().loadMask) !== "boolean") {
field.getPicker().loadMask.hide();
}
},
select: function(value) {
var obj = this.lastSelection[0].data;
return obj.nm;
this.lastSelection[0].hide;
cb_group.removeAt(0);
}
}},
renderer: function(val) {
var index = cb_group.findExact('id', val);
if (index !== -1) {
var rs = cb_group.getAt(index).data;
return rs.nm;
}
}
},
{header: subtitle_approval4, width: 126, dataIndex: 'level2', align: 'center', itemId: "level2",
editor: {xtype: "combobox", name: "cdgr", itemId: "cdgr2", typeAhead: true, editable: false, triggerAction: "all", forceSelection: true,
emptyText: grid8k, store: cb_group, valueField: "id", displayField: "nm",
listeners: {
expand: function(field, options) {
if (Ext.typeOf(field.getPicker().loadMask) !== "boolean") {
field.getPicker().loadMask.hide();
}
}
}
},
select: function(value) {
var obj = this.lastSelection[0].data;
return obj.nm;
},
renderer: function(val) {
var index = cb_group.findExact('id', val);
if (index !== -1) {
var rs = cb_group.getAt(index).data;
return rs.nm;
}
}
}]
}]}
]}]}
]});
난 this.lastSelection [0] .hide 시도한; 및 cb_group.removeAt (0); 첫 번째 콤보. 그러나 그것은 전혀 작동하지 않았습니다. 그리고 왜 내가 선택 리스너가 작동하지 않는지 알지 못합니다.
몇 가지 해결책을 알려주세요. 감사합니다
그래서 각 콤보 상자마다 2 개의 저장소를 만들어야합니까? 그리고 위에서 언급 한 기능을 어디에 배치해야합니까? var 외부 set_approval_dtl? –
두 개의 콤보 상자 각각에 대해 하나의 저장소에는 총 두 개의 저장소가 있습니다. 컴포넌트에서 리스너 객체를 사용하는 것은'component.on() '을 사용하는 것과 같기 때문에 당신은 내 함수를 받아서 리스너 : {select : function (combo, newVal) ...}에 넣을 수 있습니다. – Alexander
아, 각 콤보 상자마다 다른 저장소가 있지만 데이터는 동일합니까? 콤보 상자 이름을 호출 할 수 없습니다. 방화 광에서 오류가 발생했습니다. 내 콤보 이름은 정의되어 있지 않습니다. –