View Full Version : EXTJS MVC sending data from one view to another

30 Aug 2012, 3:19 AM
Am developing application (http://stackoverflow.com/questions/12193896/extjs-mvc-sending-data-from-one-view-to-another#) using EXTJS MVC Architecture. I have created a dataview which consists of the list of users in the system, and each item in the dataview consists of three buttons. One of them is the edit button, which on clicking opens another view. This view consists of a form where the users details can be edited. Now, what am struck in is, when i open the form, i want the users details to be loaded into the fields of the form.
So, how do i send the data from the dataview to the form so that the appropriate data, respective to the user gets loaded?
Here is the code:

init : function() {
'button[action=addUsers ]' : {
click : this.addUsers
'#userlist' : {
itemclick : this.userListSelectionChange
userListSelectionChange : function(view (http://stackoverflow.com/questions/12193896/extjs-mvc-sending-data-from-one-view-to-another#), record, h, ind, evt) {

console.log('user List clicked')

var edit = evt.getTarget('a.icon-edit-32');
var deletebt = evt.getTarget('a.icon-delete-32');

if (edit != null) {

var name = record.get('Name');


if (deletebt != null) {

var name = record.get('Name');

When the showHWindow() method is called, the form opens, and i want the form to be loaded with the data for that particular user. And, even though its printing the correct name for

var name = record.get('Name');
Am not sure how to send this data to the form.

mvc (http://stackoverflow.com/questions/tagged/mvc) extjs (http://stackoverflow.com/questions/tagged/extjs) extjs4 (http://stackoverflow.com/questions/tagged/extjs4) extjs4.1 (http://stackoverflow.com/questions/tagged/extjs4.1) extjs-mvc (http://stackoverflow.com/questions/tagged/extjs-mvc)

30 Aug 2012, 6:27 PM
You can just load the selected record into the form like:

form.loadRecord(record); // selected record from selection