0
我有一个使用qx.data.marshal.Json.createModel创建的模型,它包含一个名为“startDate”的字段,它是一个Date实例。我想重写getStartDate以便返回模型中Date和Date不同的副本。如何将自定义方法添加到使用qx.data.marshal.Json.createModel创建的模型中?
我见过http://manual.qooxdoo.org/2.1/pages/data_binding/models.html但我只找到了“查看qx.data.store.IStoreDelegate的API文档以查看可用的方法以及如何实现它们。”。 IStoreDelegate信息不完整,我不知道如何使用它(http://demo.qooxdoo.org/2.1/apiviewer/index.html#qx.data.store.IStoreDelegate)。
var delegate = {
getModelMixins : function(properties) {
}
};
var marshaler = new qx.data.marshal.Json(delegate);
marshaler.toClass(data);
var model = marshaler.toModel(data);
// the problem with weeks is that someone changes the dates
// we must make the getFromDay to return a copy of the data
weeks.append(qx.data.marshal.Json.createModel(weeksRaw));
我该怎么做?