I have one problem with adding new button for update my records in Ext-Js 3.0. I have already one window for creating new record and I intend to use the same window for editing one of the records. The question is: how can I load the record what I have choosen from existing records int the columns of the window for creating record? This code for adding a new record, I would like to load the content of such record in this window if I update it. Is it possible? I think I need something like store.load.record.data['id']?
Thank you in advance for your help.
var winAdd = new Ext.Window({
id: 'winAdd',
renderTo: Ext.getBody(),
layout: 'fit',
width: 400,
autoHeight: true,
closeAction: 'hide',
closable: false,
title: 'add item',
plain: true,
items: {
xtype: 'form',
id: 'frmAdd',
autoHeight: true,
frame: true,
defaultType: 'textfield',
border: false,
dock_id: <?=$_SESSION['user']->getDock()->getId()?>,
defaults: {allowBlank: true, anchor: '95%'},
items: [{
fieldLabel: 'dock',
hiddenName: 'dock',
name: 'dock',
xtype: 'combo',
store: strRamps,
displayField: 'name',
valueField: 'id',
typeAhead: true,
mode: 'local',
triggerAction: 'all',
forceSelection: true
},
This is code for update the record:
new Ext.Toolbar.Button({
text: '<?= $this→translate('edit item') ?>',
handler: function () {
Ext.getCmp('winAdd').show(this);
var conn = new Ext.data.Connection();
conn.request({
url: 'example/updateItem',
method: 'POST',
params: {id: gridPanel.selModel.selection.record.data['id']},
success: function (responseObject) {
store.update(gridPanel.selModel.selection.record);
},
})
}
}