Javascript EXTJS表单:如何只更新记录,而不是整个记录

Javascript EXTJS表单:如何只更新记录,而不是整个记录,javascript,mongodb,extjs,format,Javascript,Mongodb,Extjs,Format,我制作了一个编辑表单,用新的注释更新注释数组。到目前为止一切都很好 这家商店来自MongoDB 该记录有一个ISO日期,当我更新它时,会将其更改为字符串 由此: "tmx" : ISODate("2015-07-19T00:26:53.000Z") 为此: "tmx" : "Sun Jul 19 2015 00:55:23 GMT+0100 (Hora de Verão de GMT)" 样本记录: "tmx" : ISODate("2015-07-19T00:26:53.000Z"), "

我制作了一个编辑表单,用新的注释更新注释数组。到目前为止一切都很好

这家商店来自MongoDB

该记录有一个ISO日期,当我更新它时,会将其更改为字符串

由此:

"tmx" : ISODate("2015-07-19T00:26:53.000Z")
为此:

"tmx" : "Sun Jul 19 2015 00:55:23 GMT+0100 (Hora de Verão de GMT)"
样本记录:

"tmx" : ISODate("2015-07-19T00:26:53.000Z"),
"comments" : [{
    "comment" : "tury",
    "date" : "2015-11-19T01:15:13.552Z"
}]
我的表格:

var form = new Ext.form.FormPanel({
    width: 500,

    items: [{
        xtype: 'grid',
        store: storearray,
        margin: "0 0 10 0",
        columns: [{
            id: 'comment',
            header: "Text",
            autoSizeColumn: true,
            flex: 1,
            sortable: true,
            dataIndex: 'comment'
        }, {
            id: 'date',
            header: "Date",
            dateFormat: 'm-d-Y g:i A',
            autoSizeColumn: true,
            flex: 1,
            sortable: true,
            dataIndex: 'date'
        }],
        layout: {
            type: 'fit',
            align: 'stretch'
        }
    }, {
        xtype: 'textarea',
        id: 'new',
        text: 'Add Comment',
        style: 'width: 100%',
        fieldLabel: 'Add Comment',
        layout: {},
        name: 'comment'
    }],
    dockedItems: [{
        xtype: 'toolbar',
        flex: 1,
        dock: 'bottom',
        ui: 'footer',
        layout: {
            pack: 'end',
            type: 'hbox'
        },
        items: [{
            xtype: 'button',
            text: 'Cancel',
            itemId: 'cancel',
            iconCls: 'cancel'
        }, {
            xtype: 'button',
            text: 'Save',
            itemId: 'save',
            iconCls: 'save',
            handler: function (form, rowIndex, colIndex) {
                var recform = this.up('form').getForm().getRecord();
                var names = recform.get('comments');
                var arraysize = names.length;
                var val = Ext.getCmp('new').getValue();
                var actual = new Date().toISOString();
                if(val == "") {
                    alert('Comentario Vazio');
                } else {
                    names.push({'comment': val, 'date': actual});
                    recform.save();
                    var newRecord = store.sync();
                    this.up('form').getForm().setRecord(newRecord);
                    this.up('form').refresh();
                }
            }
        }]
    }]
});
我想做的就是更新字段,或者让我的日期保持在ISODate格式。新的评论日期也将被插入asISODate


有什么建议吗?

更新记录/模型中的特定字段:

集合(字段名,新值,[选项]):字符串[] 将给定字段设置为给定值,将实例标记为脏实例

资料来源:

在您的示例中,如果我理解正确,请执行以下操作:

var recform = this.up('form').getForm().getRecord();
var actual = new Date().toISOString();
recform.set('comments', actual);

只是一些问题:
autoSizeColumn
实际上是一个配置参数吗?不是一个方法,也不是一个配置?
autoSizeColumn
(如果是配置)和
flex
config是否冲突?