View Full Version : set default value to editor of the editor grid

1 Jul 2010, 10:03 PM
Is it possible when clicking to edit editor grid panel autamtically set default value to the editor

http://my.jetscreenshot.com/1668/20100702-k2ka-4kb.jpg - after the double clicking there is no value I want to set the default value

I try this:

editor: new Ext.form.DateField({ format:'Y-m-d', value: new Date().format('Y-m-d' }); - but it does not help ...

Please help me

Thanks :)

1 Jul 2010, 10:56 PM
The editor is initialized with the current value of the record field, so setting a value in the editor has no effect.

If you want to return a default value instead of blank then I suggest writing a preEditValue method for EditorGridPanel, e.g.

var grid = new Ext.grid.EditorGridPanel({
preEditValue: function(record, field){
var v = this.constructor.prototype.preEditValue.call(this, record, field);
if (field == 'myfield' && !v) {
v = new Date();
return v;

2 Jul 2010, 5:06 AM
Thank you very much :)