PDA

View Full Version : [SOLVED] RowEditor with Combobox



mjhaston
24 Aug 2011, 5:40 AM
Ended up passing multiple values back in the value field and sub-stringing to parse.




I have a RowEditor with Combobox that works just fine. My issue is the combobox returns two fields ... userid and name. I return userid to the appropriate gridcolumn. I would then like "name" to populate the next gridcolumn over with the id of "textbox".

I can't seem to figure out how to access it to setValue. I put the field I'd like to populate and my failed attempts in red.





var editor = new Ext.ux.grid.RowEditor({
saveText : "Update",
cancelText : "Cancel",
// clicksToEdit: 1,
errorSummary : true
});

var userMaintenanceGrid = new Ext.grid.GridPanel({
id : 'userMaintenanceGrid',
store : userMaintenanceStore,
plugins : [editor],
deferRowRender : true,
stripeRows : true,
autoExpandColumn : false,
tbar : {
xtype : 'toolbar',
items : [{
xtype : 'button',
text : 'Add User',
iconCls : 'icon-user_add',
handler : function() {
var e = new User({
gUserid : 'USERID',
gName : 'USER NAME'
// gStates : 'Select states',
// gZips : 'Enter zips'
});
editor.stopEditing();
userMaintenanceStore.insert(0, e);
userMaintenanceGrid.getView().refresh();
userMaintenanceGrid.getSelectionModel().selectRow(0);
editor.startEditing(0);
//reloadTree;
}
}, {
xtype : 'button',
text : 'Remove User',
iconCls : 'icon-user_delete',
ref : '../removeBtn',
disabled : true,
handler : function() {
editor.stopEditing();
var s = userMaintenanceGrid.getSelectionModel()
.getSelections();
for (var i = 0, r; r = s[i]; i++) {
userMaintenanceStore.remove(r);

Ext.Ajax.request({
url : '/cgidev2p/jsonsbm002.pgm',
method : 'POST',
params : {
dummy : 'remove-record',
pAction : 'remove',
pUserid : r.get('gUserid'),
pName : r.get('gName'),
pStates : r.get('gStates'),
pZips : r.get('gZips')
},
success : function() {

}
});
}

}
}]
},
columns : [{
xtype : 'gridcolumn',
header : 'User ID',
width : 100,
dataIndex : 'gUserid',
sortable : true,
editor : {
allowBlank : true,
xtype : 'combo',
store : 'userProfileStore',
name : 'combo-userid',
id : 'combo-userid',
displayField : 'wrkusrprf_userid',
valueField : 'wrkusrprf_userid',
anchor : '0 0',
// fieldLabel : 'Member Name',
// emptyText : 'Start typing member ssn or name',
listeners : {
scope : this,
'select' : function() {
// Ext.getCmp('textbox').setValue('wrkusrprf_name');
// userMaintenanceGrid.getForm().findField('gName').setValue('wrkusrprf_name');
}
}
}
}, {
xtype : 'gridcolumn',
id : 'textbox',
header : 'Name',
width : 150,
dataIndex : 'gName',
sortable : true,
editor : new Ext.form.TextField()
}, {
xtype : 'gridcolumn',
header : 'States',
width : 200,
dataIndex : 'gStates',
sortable : true,
editor : {
xtype : 'superboxselect',
id : 'grid-superbox',
fieldLabel : 'State(s)',
resizable : true,
name : 'state',
anchor : '100%',
store : states2,
mode : 'local',
displayField : 'state',
displayFieldTpl : '{state} ({abbr})',
valueField : 'abbr',
navigateItemsWithTab : false,
emptyText : 'Click arrow to select state(s)'
}
}, {
xtype : 'gridcolumn',
header : 'Zips',
width : 150,
dataIndex : 'gZips',
sortable : true,
emptyText : 'Enter zips separated by comma or space',
editor : new Ext.form.TextField()
}],
bbar : {
xtype : 'paging',
store : 'userMaintenanceStore',
autoScroll : true,
pageSize : 20,
displayInfo : true,
displayMsg : 'Displaying user(s) {0} - {1} of {2}',
emptyMsg : "No users found",
baseParams : {
// recordID : Ext.getCmp('combo-ssn').getValue(),
start : 0,
limit : 20,
dummy : 'paging-users'
}

}
});