0

我有以下代码

    var record = form.getRecord();
    var values = form.getValues();
    record.set(values); 
   // record.data.DeliveryFrom = "test1";
    record.set('DeliveryFrom', 'test2');
    record.save();

从表单中获取值后,我希望覆盖属性 DeliveryFrom。但是,当我在萤火虫 DeliveryFrom 中查看结果时,我为空。你会在上面看到我尝试了 2 种不同的方法来设置这个值。

我正在使用 extjs 4.1

4

1 回答 1

1

应该有效(假设Ext.form.Basic)如果不是(如果它Ext.form.Panel)形成它,那么使用form.getForm()

var record = form.getRecord();
form.updateRecord(record); //We use update record, its almost the same as you were using but in just one call
record.beginEdit(); //Put the record in edit mode
record.set( 'DeliveryFrom', 'test2');
record.endEdit(); //End editing the record and commit changes
record.save(); //Commit changes to backend
于 2013-01-14T17:42:29.930 回答