PDA

View Full Version : Multiple fields in a grid column editor



Jad
30 Mar 2012, 12:09 AM
Hi,

I have a column grid witch is rendered like that


getRenderer: function(value) {
var me = this,
html = '',
rec = JSON.parse(value);

html += '<div class="description">Description :<br />' + rec.description + '</div>';
html += '<div class="prices">';
html += '<span class="label">Quantity : </span>';
html += '<span class="value">'+ rec.nbr + '</span>';
html += '<span class="label">Price : </span>';
html += '<span class="value">'+ rec.price + '</span>';
html += '<span class="label">Tax : </span>';
html += '<span class="value">'+ rec.tax + '%</span>';
html += '<span class="label">Total : </span>';
html += '<span class="value">'+ me.calculatePrice(rec.price, rec.tax, rec.nbr) + '</span>';
html += '</div>';

return html;
},


And I want to now how can I have a getEditor methode withe multiple fields to edit this informations.

Thanks a lot

:D

mitchellsimoens
30 Mar 2012, 8:55 AM
The grid editor will only have one field per column. You may want to pop open a floating form or have a form somewhere to edit a record.

Jad
2 Apr 2012, 4:37 AM
I've found a solution :
I create an Editor who extend Ext.container.Container and mixin Ext.form.field.Field

nKamate
18 Dec 2014, 4:54 AM
Hey Jad, I have similar requirements and your solution "Editor who extend Ext.container.Container and mixin Ext.form.field.Field" is very effective. Do you have any working demo or a piece of code that will show further code? I want to know how you set the field values and set them back into the record.

jad_Topnetwork
18 Dec 2014, 11:22 PM
I am sorry but I do not have access to the code anymore

Jad
18 Dec 2014, 11:33 PM
I found this code, it's not the same case but it will ready ;-)


getEditor: function (record, defaultField) {
return Ext.create('Ext.grid.CellEditor', {
field: Ext.create( 'Ext.ux.ColorField', {
editable: false,
width: 10,
listeners:{
change: function (field, newValue, oldValue) {
record.set({ color: newValue });
}
}
})
});
},

nKamate
19 Dec 2014, 2:54 AM
In my case, I want to display multiple fields in a single cell. I have a number field and a combobox to be shown in the same cell when editing is started. Any leads?

With "Editor who extend Ext.container.Container and mixin Ext.form.field.Field", I am not able to fire a completeEdit event that will hide the editor component

nKamate
19 Dec 2014, 3:01 AM
With "Editor who extend Ext.container.Container and mixin Ext.form.field.Field", I am not able to fire a completeEdit event that will hide the editor component

Jad
19 Dec 2014, 9:01 AM
you can fire it yourself after special key