Hello, after doing ext js 3.4 for a few years I am starting Ext JS 4. I am writing a new application and have run into an odd issue. I have created a controller that has a controller action which is tied to a button click. So every time I click a button I have a function that is executed. My issue is that every time I click any button (including tabs), my function is executed. I specified the specific button I wanted this function tied to in the targetType field of the Config panel in archetict. I am sure I am making a nooby mistake, I just do not know where.
My code is below, any ideas are most appreciated.
Code:
Ext.define('DPM.controller.searchPartyButtonClick', {
extend: 'Ext.app.Controller',
views: ['PartySearchButton'],
buttonClick: function (button, e, eOpts) {
var firstName = Ext.ComponentQuery.query('#firstNameField')[0].getValue();
var middleName = Ext.ComponentQuery.query('#middleNameField')[0].getValue();
var lastName = Ext.ComponentQuery.query('#lastNameField')[0].getValue();
var address = Ext.ComponentQuery.query('#address1Field')[0].getValue();
var city = Ext.ComponentQuery.query('#cityField')[0].getValue();
Ext.Ajax.request({
url: 'http://localhost:8080/DuplicatePartyManagement/servlet/searchParties',
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
jsonData: {
firstName: firstName,
lastName: lastName
},
success: function (response, opts) {
var obj = Ext.decode(response.responseText);
},
failure: function (response, opts) {}
});
},
init: function (application) {
this.control({
"button": {
click: this.buttonClick
}
});
}
});
sorry the code is all on one line, not sure why it would not format correctly