ExtJS FromPanel静的jsonを埋め込む
6359 ワード
の1つの項目をして、ExtJS Gridの中の1行を選択する必要がある時、ボタンを改正して弾き出すExtJSウィンドウのFromPanelをクリックして選択した行のjsonデータを埋めます.
実装方法は、まずGrid選択行のデータを得る
実装方法は、まずGrid選択行のデータを得る
// , json , data
grid.getSelectionModel().on('rowselect', function(sm, rowIdx, r){
qTitleId = r.data.id;
alert("id:" + Ext.util.JSON.encode(r.data));
data = r.data;
});
//
function openDialog(){
Ext.useShims=true;
var win=new Ext.Window(
{title:" ",
width:370,
height:200,
modal:true,
closeAction:"close",
layout:"fit",
items:[
new Ext.FormPanel({
id:"formPanel",
frame:true,
x:40,
y:30,
labelAlign:"right",
labelWidth: 85,
width:360,
height:400,
border:false,
waitMsgTarget: true,
// region:"west",
reader : new Ext.data.JsonReader({
//root:'showInfoList'
}, [
{name:'id',mapping:'id',type:'int'},
{name:'Qtitle',mapping:'Qtitle'},
{name:'isCheckBox',mapping:'isCheckBox'},
{name:'isAvalible',mapping:'isAvalible',type:'int'}
]),
items: [
new Ext.form.FieldSet({
title: ' ',
width:340,
autoHeight: true,
defaultType: 'textfield',
items: [{
fieldLabel: 'ID',
//emptyText: ' stam.qq.com',
name: 'id',
allowBlank: false,
width:190,
hidden:true
},{
fieldLabel: ' ',
name: 'Qtitle',
allowBlank: false,
width:190
},
new Ext.form.ComboBox({
fieldLabel: ' ',
hiddenName:'isCheckBox',
allowBlank:false,
//blankText:' ',
store: new Ext.data.ArrayStore({
fields: ['abbr', 'isCheckBox'],
data : [
[0,' '],
[1,' ']]
}),
valueField:'abbr',
displayField:'isCheckBox',
typeAhead: true,
mode: 'local',
triggerAction: 'all',
selectOnFocus:true,
width:190
})
,
new Ext.form.ComboBox({
fieldLabel: ' ',
hiddenName:'isAvalible',
allowBlank:false,
blankText:' ',
store: new Ext.data.ArrayStore({
fields: ['abbr', 'isAvalible'],
data : [
[0,' '],
[1,' ']]
}),
valueField:'abbr',
displayField:'isAvalible',
typeAhead: true,
mode: 'local',
triggerAction: 'all',
selectOnFocus:true,
width:190
})
]
})
]
})
],
buttons:[{
text:" ",handler:function(){
}}, {
text:" ",handler:function(){
win.close();
}
}]
});
win.show();
//
win.on("close",function(){
});
}
//
var centerPanel = new Ext.Panel({
id:"centerPanel",
title:" ",
layout:"fit",
region:"center",
//width:"75%",
tbar:[//
{
id:'updatenode',
text: ' ',
iconCls : 'option',
//pressed : true,
handler : function(){
if(qTitleId == 0){
Ext.Msg.alert(" "," ");
}else{
openDialog();
alert(data);
Ext.getCmp("formPanel").form.loadRecord(new Ext.data.MemoryProxy(data));//
}
}
}],
items:[
grid
]
});