If anyone can help here's what I'm trying to do, I have a grid, with data from my store, if an item is double clicked then a controller handles the event and opens up an edit window, the form loads from the passed in record. So the form has a record defined, the way I understand updateRecord() is that it does not require a record parameter if the form already has one associated to it.
But I am getting the following error. (Uncaught TypeError: Cannot read property 'fields' of undefined)
Here is the controller
Code:
Ext.define('Inters.controller.IntersController', { extend: 'Ext.app.Controller',
views: [
'Inters'
],
onGridviewItemDblClick: function(tablepanel, record, item, index, e, options) {
// console.log(record.get('studentid'));
var x = Ext.create('Inters.view.Edit');
Ext.getCmp('Overview').loadRecord(record);
x.show();
},
init: function(application) {
this.control({
"gridpanel": {
itemdblclick: this.onGridviewItemDblClick
}
});
}
});
And the Edit window definition with the btnSave click event that I am getting the error.
Code:
Ext.define('Inters.view.Edit', { extend: 'Ext.window.Window',
height: 502,
id: 'wEdit',
width: 752,
title: 'Edit',
modal: true,
initComponent: function() {
var me = this;
Ext.applyIf(me, {
dockedItems: [
{
xtype: 'tabpanel',
dock: 'top',
height: 472,
activeTab: 0,
dockedItems: [
{
xtype: 'form',
dock: 'top',
height: 427,
id: 'Overview',
layout: {
type: 'absolute'
},
bodyPadding: 10,
title: 'Overview',
items: [
{
xtype: 'textfield',
id: 'frmFirstName',
width: 260,
name: 'firstname',
fieldLabel: 'First name'
},
{
xtype: 'textfield',
x: 10,
y: 50,
id: 'frmLastName',
width: 260,
name: 'lastname',
fieldLabel: 'Last name'
},
{
xtype: 'button',
x: 297,
y: 255,
id: 'btnSave',
text: 'Save',
listeners: {
click: {
fn: me.onBtnSaveClick,
scope: me
}
}
}
]
}
]
}
]
});
me.callParent(arguments);
},
onBtnSaveClick: function(button, e, options) {
console.info(button);
console.log(e);
console.log(options);
var basicForm = button.up('form').getForm();
basicForm.updateRecord(basicForm.record);
}
});
Does anyone have any suggestions, answers to my problem. I am new to ExtJS and an intermediate js programmer with little experience with frameworks.