extjs - Concatenate in EditorGridPanel -
Inside my editor gridpayel, I have three columns, I directly from within my 'first name' and 'last name' column Want to add data or when the cursor or focus in each row comes in my 'Email Address' column Can someone help me with this problem?
var cm = new Ext.grid.ColumnModel ({default: {sortable: true}, column: [{id: 'id', header: id ', datindex:' id ' Width: 220, editable: false, hidden: true}, {id: 'first name', header: 'first name', dataindex: 'firstname', width: 220, editor: new FM (): (click Enable ();}}}, {{allowblank: false}}, {id: 'final}', 'end_button' Name ', header:' last name ', datindex:' last name ', width: 220, align:' left ', editor: new FM Texts Enabled ();}}}, {id: 'Email_address', header: 'email address', dataindex: 'email_address', width: 330, align: 'left', editor: new FM textfield ({allowBlank: false}), listeners: {click: function () {Ext.getCmp ('b_save'). Enable (); Ext GetCmp ('b_cancel'). Enabled ();}}}, var grid = new Ext.grid.EditorGridPanel ({viewConfig: (force: true), id : 'Meridrid', Store: Store, Semi, Semi, Width: 700, Anchor: '100%', Height: 700, Frame: Correct, Load Mask: True, Wait Waiting Sh: Loading ... ', ClientAdit: 2, SAP: New Extension. Grid .Press Selection Models ({single selection: true, on editor: function (field, e) {if (e.getKey () = = E.ENTER) {var k = E.getKey (), nucleale, g = this.grid, ed = g.activeEditor || G.lastActiveEditor; E.stopEvent (); /*ed.completeEdit();*/ if (E. Schiftki) {newCell = g.walkCells (ed.row, ed.col-1, -1, this.acceptsNav, this); } Else {newCell = g.walkCells (ed.row, ed.col + 1, 1, this.acceptsNav, this); } If (Newcomel) {g.startEditing (new call [0], new call [1]); }} And if (E.J.K.KE) == ETAB) {var k = EKKKE), Newseil, G = this.grid , Ed = g.activeEditor || G.lastActiveEditor; E.stopEvent (); NewCell = g.walkCells (ed.row, ed.col + 1, 1, this.acceptsNav, this); If (newcomel) {g.startEditing (new call [0], new call [1]); }}}}},});
You created the concatenated first name and last name For the editorgrid , set the value as the value in your email_address field in the listener: Listener: {Beforeedit: function (e) {if (e.field === 'email_address' and amp; e.value === '') {var newValue = e.record.get ('firstname') + '.' + E.record.get ('lastname'); E.record.set ('email_address', newValue); For example:
Comments
Post a Comment