Code:
//craete Form for Dialog
frmDLg = new Ext.form.Form({
labelWidth: 100,
reader : new Ext.data.JsonReader({
root: 'myFriends', totalProperty: 'totalCount'
}, [
{name: 'YoureNameField1', mapping: 'YoureNameField1', type: 'string'},
{name: 'YoureNameField1', mapping: 'YoureNameField1', type: 'string'},
{name: 'YoureNameField1', mapping: 'YoureNameField1', type: 'int'}
]),
labelAlign: 'right',
buttonPosition:'left'
});
frmDLg.add(
new Ext.form.TextField({
fieldLabel: 'Filed 1',
name: 'YoureNameField1',
width:350
}),
new Ext.form.TextField({
fieldLabel: 'Filed 2',
name: 'YoureNameField2',
width:350
}),
new Ext.form.TextField({
fieldLabel: 'Filed 3',
name: 'YoureNameField3',
width:30
})
);
// on event rowdblclick of grid
XGrid.on('rowdblclick',function(){
if (!dlgForm){
dlgForm = new Ext.LayoutDialog("dlgfrm", {
autoCreate: true,
width:500,
height:300,
shadow:true,
resizable:false,
collapsible:false,
modal:true,
center: {
autoScroll:true,
tabPosition: 'top',
closeOnTab: true,
alwaysShowTabs: true
}
});
dlgForm.addKeyListener(27, dlgForm.hide, dlgForm);
dlgForm.addButton('Save', fnSave, this);
dlgForm.addButton('Cancel', dlgForm.hide, dlgForm);
layoutDlg = dlgForm.getLayout();
layoutDlg.beginUpdate();
layoutDlg.add('center', new Ext.ContentPanel('tab1', {autoCreate:true, title: 'Tab 1', background:true}));
layoutDlg.endUpdate();
}
layoutDlg.showPanel('tab1');
dlgForm.setTitle('Dialog Title');
dlgForm.show();
//render and load form data
frmDLg.render('tab1');
var id = EdGrid.getSelectionModel().getSelected().data['fieldID'];//set params
frmDLg.load({url: 'res/jgrid.php', params:'ID='+id+''}); //JSON file
})
regards.