2013년 10월 16일 수요일

Displaying a detailed window after clicking a DataView node

var editForm = Ext.create('Ext.form.Panel', {
border: false,
items: [{
xtype: 'textfield',
name: 'title',
width: 300,
fieldLabel: 'Title'
}, {
xtype: 'textarea',
name: 'description',
width: 300,
height: 100,
fieldLabel: 'Description'
}, {
xtype: 'numberfield',
name: 'severity',
width: 300,
fieldLabel: 'Severity',
value: 1,
minValue: 1,
maxValue: 5
}, {
xtype: 'combo',
name: 'status',
width: 300,
fieldLabel: 'Status',
store: ['Open', 'In Progress', 'Complete'],
queryMode: 'local'
}]
});

var win = new Ext.window.Window({
height: 250,
width: 500,
title: 'Edit Bug',
modal: true,
items: [editForm],
closeAction: 'hide',
buttons: [{
text: 'Save',
handler: function(){
// save logic here
}
}]
});

dataview.on({
itemclick: function(view, record, item, index, e, opts){
// populate the form with the clicked record
editForm.loadRecord(record);
win.show();
}
});

handler: function(){
// save data
var selectedRecord = dataview.selModel.getSelection()[0];
selectedRecord.set(editForm.getValues());
// refilter
dataview.getStore().filter();
win.close();
}

댓글 없음:

댓글 쓰기